multiples in python. | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
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 Réponse
+ 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