On Sunday, January 27, 2013 1:57:47 PM UTC-5, [email protected] wrote:
> I am in a class and was just looking for different advice. This is the first
> time iv ever tried to do this. That's all that iv taken from two chapters and
> wondering how bad I did. I also like to learn. Thanks for everyones input
This is what I have now thanks for the advice. It did seem a lot easier this
way, but any criticism would be nice thanks.
windows 7 and python 3.3.0
while True:
try:
miles = float(input("How many miles did you drive?"))
break
except ValueError:
print("That is not a valid number. Please try again.")
while True:
try:
gas = float(input("How many gallons of gas did you use?"))
break
except ValueError:
print("That is not a valid number. Please try again.")
mpg = miles/gas
print('Your miles per gallons is', format(mpg,'.2f'))
--
http://mail.python.org/mailman/listinfo/python-list