Unformatted text preview: print "gotGoodInput",gotGoodInput # Now it is safe to do the conversion; the program will not # crash because the conversion fails. feet = int(reply) f gotGoodInput = False print "gotGoodInput",gotGoodInput while not gotGoodInput: reply = raw_input("Inches: ") if cc.couldBeInt(reply): gotGoodInput = True else: print "not valid input" print "gotGoodInput",gotGoodInput inches = int(reply) i # Total height in inches inches = (feet*12) + inches i # Figure out weight assuming Body Mass Index is 24 weight = (24.0 * inches * inches)/703 w # Notice that the weird string in front of weight, connected to it by # the % operator, formats it to print out with one decimal place. print "I guess your weight is","%.1f"%weight p raw_input("Press enter to exit.")...
View Full Document
- Spring '07
- Mass, Imperial units, United States customary units, Body mass index, String reply, (reply)