i know i should use input but when i changed to raw_input it wouldn't recognise the word print on the next line. honestly i have tried everything to get this working..i am 6 hrs at one program
Adrian Kelly 1 Bramble Close Baylough Athlone County Westmeath 0879495663 From: waynejwer...@gmail.com Date: Thu, 17 Nov 2011 16:53:59 -0600 Subject: Re: [Tutor] please help - stuck for hours To: kellyadr...@hotmail.com CC: tutor@python.org 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