<div class="gmail_quote">On Thu, Nov 17, 2011 at 4:32 PM, ADRIAN KELLY <span dir="ltr"><<a href="mailto:kellyadrian@hotmail.com">kellyadrian@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div dir="ltr">
<br><font face="Tahoma" size="2">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??</font><div>
<font face="Tahoma" size="2"></font></div></div></div></blockquote><div><br></div><div>Computers are unfailingly stupid machines. They will do whatever wrong thing you tell them to do every single time.</div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div dir="ltr"><div><font face="Tahoma" size="2"> </font><font size="2"><snip></font><div class="im"><div>def main():</div></div><div> amount=0</div><div> while amount<50:</div><div class="im"><div> amount = input('how much do you want to change:')</div>
</div><div> print 'enter an amount over €50: '</div><div class="im"><div> else:</div><div> total=exchange(amount)</div><div> print 'Your exchange comes to: ',total</div></div></div>
</div></div></blockquote><div><br></div><div>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:</div><div><br></div><div> 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)</div>
<div> </div><div> 2. If the value is less than 50, tell the user to enter an amount > 50 and repeat step 1</div><div><br></div><div> 3. Otherwise, exchange the amount and display that.</div><div><br></div><div>Right now, these are the steps that you're doing:</div>
<div><br></div><div> 1. Get a value from the user</div><div><br></div><div> 2. Display the error message</div><div><br></div><div> 3. If the value is < 50, go to 1</div><div><br></div><div> 4. exchange the amount</div>
<div><br></div><div> 5. display the amount.</div><div><br></div><div>HTH,</div><div>Wayne</div></div>