Diagram
TypeError: can’t multiply sequence by non-int of type ‘float’ error occurs when “you use the input() function, which takes user input”. The input() function returns user input as a “string” by default.
To fix the TypeError: can’t multiply sequence by non-int of type ‘float’ error, “convert the string into a floating-point number using float() function before multiplying it with a float”.
When you try multiplying a float and a value, not an integer or string, you will encounter a TypeError can’t multiply sequence by non-int of type ‘float’ error.
Reproducing the error
user_input = input("Please enter your age: ")
print(user_input * 0.5)
Output
Please enter your age: 18
TypeError: can't multiply sequence by non-int of type 'float'
How to fix the error
You can use the “float()” function to convert the string data type and multiply it with a float value.
import math
# Get user input and convert it to a float
user_input = float(input("Please enter your age: "))
print(user_input * 0.9)
Output
Please enter your age: 34
30.6
In this code, we converted user input into a float and multiplied it by the float value. This way, you avoid the TypeError: can’t multiply sequence by non-int of type float error when working with user input.
That’s it!

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.