By default input() function in Python helps in taking user input as string. If any user wants to take input as int or float, we just need to typecast it.
Example: Taking the default (string) user input:
color = input("What color is rose?: ")
print(color)
Output
What color is rose?: Red
Red
Taking Integer Inputs
We can typecast the user input to integer type by wrapping the input statement by int():
n = int(input("How many roses?: "))
print(n, type(n))
Output
How many roses?: 88
88 <class 'int'>
Taking Float or Decimal Inputs
We can typecast the user input to float or decimal type by wrapping the input statement by int():
price = float(input("Price of each rose?: "))
print(price, type(price))
Output
Price of each rose?: 69.420
69.420 <class 'float'>