input function always produces a string output. If you want to output an integer you have to use int. example
If you want to number output from this below code
user_input = input("enter a number: ")
print(user_input ** 2)
it’ll show error like
Traceback (most recent call last):
File "try_input.py", line 2, in <module>
print(user_input ** 2)
So, you have to convert that string to an integer.
user_input = input("enter a number: ")
print(int(user_input) ** 2)
If you try this now under 10, you’ll get 100.
enter a number: 10 100
Reply