<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
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..<div>i am 6 hrs at one program</div><div><br></div><div><br><br> <br>
<font size="3"><font color="#000000"><font face="Times New Roman"> </font></font></font><font size="3"><font color="#000000"><font face="Times New Roman"> </font></font></font><br>
Adrian Kelly <br>1 Bramble Close<br>
Baylough<br>
Athlone<br>
County Westmeath<br><br>0879495663<br><br><br><div><hr id="stopSpelling">From: waynejwerner@gmail.com<br>Date: Thu, 17 Nov 2011 16:53:59 -0600<br>Subject: Re: [Tutor] please help - stuck for hours<br>To: kellyadrian@hotmail.com<br>CC: tutor@python.org<br><br><div class="ecxgmail_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="ecxgmail_quote" style="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="ecxgmail_quote" style="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="ecxim"><div>def main():</div></div><div> amount=0</div><div> while amount<50:</div><div class="ecxim"><div> amount = input('how much do you want to change:')</div>
</div><div> print 'enter an amount over ¤50: '</div><div class="ecxim"><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></div></div>                                            </div></body>
</html>