multiples in python. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

multiples in python.

Why doesn't it work? I think because python thinks it was a string and can't perform the action, so I tried to change it to the int type using int() function for workh and payr variables but it didn't work either. What did I miss in this code? Thanks workh = input('How many hours did you work this week?') payr = input('How much for one hour?') money = workh*payr TypeError: can't multiply sequence by non-int of type 'str'

22nd Jun 2017, 4:43 PM
Luan Mai
Luan Mai - avatar
1 Answer
+ 2
You were correct and probably just didn't convert it to an int properly. Example/ worh = int(input()) Do this for both variables. This is because input() returns a String, that being the users input.
22nd Jun 2017, 5:06 PM
Rrestoring faith
Rrestoring faith - avatar