| [SOLVED] error when running program with python? hi,
I'm writing a program using Python and it works with whole numbers (like 1,2,3,40, etc) but I would like to use numbers like .12, .13, .04, etc). Every time I run this program using these numbers it brings up an error message:
# A simple adding calculator (use numbers like .12, .14, etc)
a = int (raw_input ("enter first number: "))
b = int (raw_input ("enter second number: "))
print a + b
The error message I get is this:
Traceback (most recent call last):
File "C:\Python25\horse program.py", line 1, in <module>
a = int (raw_input ("enter first number: "))
ValueError: invalid literal for int() with base 10: '.01'
How can I modify the program so it accepts numbers like .12, .13, .14....etc?
Thanks for your time! |