"jtl999" <jacksmoo...@gmail.com> wrote

when I try to multiply with a decimal number in python with the input
this is what i get

Enter first number: 1.2
Traceback (most recent call last):
 File "Timesed.py", line 18, in <module>
   numberx1 = (int)(raw_input('Enter first number: '))
ValueError: invalid literal for int() with base 10: '1.2'

You are inputting a floating point number - 1.2 and
trying to convert it to an integer. You need to convert
raw_input to a float() rather than an int()

HTH,


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to