Question:
Cant multiply user input by a float
Repl link:
hours = input("How many hours?")
hours = (hours * 0.25)
of course doing this code gets the error:
TypeError: can't multiply sequence by non-int of type 'float'
Question:
Cant multiply user input by a float
Repl link:
hours = input("How many hours?")
hours = (hours * 0.25)
of course doing this code gets the error:
TypeError: can't multiply sequence by non-int of type 'float'
When you use the input
in Python the result will be a string. To make it a number put Int()
around it.
Remember Python is case-sensitive, the i in int
needs to be lowercase.
Thanks for adding that. Never used it so wouldn’t know lol. Thats what happens when a JS dev answered a python question (looking at you Number()
)
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.