<br><br><div class="gmail_quote">On Sat, Oct 25, 2008 at 4:42 PM, <span dir="ltr"><<a href="mailto:chemicalclothing@temple.edu">chemicalclothing@temple.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi. I'm very new to Python, and so this is probably a pretty basic<br>
question, but I'm lost. I am looking to limit a float value to a<br>
number between 0 and 100 (the input is a percentage).<br>
<br>
I currently have:<br>
<br>
integer = int()<br>
running = True<br>
<br>
while running:<br>
try:<br>
per_period_interest_rate = float(raw_input("Enter per-period<br>
interest rate, in percent: "))<br>
break<br>
except ValueError:<br>
print "Please re-enter the per-period interest rate as a number<br>
between 0 and 100."<br>
<br>
<br>
I also have to make sure it is a number and not letters or anything.<br>
<br>
Thanks for the help.<br>
<br>
James<br>
<br>
P.S. I don't understand a lot of what I have there, I got most of it<br>
from the beginning tutorials and help sections. I have never<br>
programmed before, but this is for a school assignment.<br>
<font color="#888888">--</font></blockquote><div><br>look up conditionals (specifically if statements) in the Python tutorial. If you still can't figure it out, ask on the Python Tutor list. This list is for questions about python, not for questions about how to program.<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><font color="#888888"><br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br>