[Tutor] Dividing a float derived from a string
svmorrow at gmail.com
Thu Nov 20 22:20:27 CET 2014
I have been posed with the following challenge:
"Create a script that will ask for a number. Check if their input is a
legitimate number. If it is, multiply it by 12 and print out the result."
I was able to do this with the following code:
input = raw_input("Insert a number: ")
print int(input) * 12
*However*, a colleague of mine pointed out that a decimal will return as
False. As such, we have tried numerous methods to allow it to divide by a
decimal, all of which have failed. Do you have any suggestions?
Additionally, we are using 2.7, so that might change your answer.
Thank you in advance for any help you can provide!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor