On Thu, Nov 17, 2011 at 4:32 PM, ADRIAN KELLY <kellyadr...@hotmail.com>wrote:
> > thanks very much, great response really really appreciated it and now i > understand. i hate to ask again but can you see why it won't print the > 'enter and amount over 50' in the right place?? > Computers are unfailingly stupid machines. They will do whatever wrong thing you tell them to do every single time. > <snip> > def main(): > amount=0 > while amount<50: > amount = input('how much do you want to change:') > print 'enter an amount over €50: ' > else: > total=exchange(amount) > print 'Your exchange comes to: ',total > Sometimes it helps writing out the logic in steps before you translate it to code. In this case my guess is that these are the steps you want: 1. Get a value from the user (you're still using input - stop that, it's dangerous! input is only a good function in 3.x where it replaces raw_input) 2. If the value is less than 50, tell the user to enter an amount > 50 and repeat step 1 3. Otherwise, exchange the amount and display that. Right now, these are the steps that you're doing: 1. Get a value from the user 2. Display the error message 3. If the value is < 50, go to 1 4. exchange the amount 5. display the amount. HTH, Wayne
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor