Python gives us freedom to take the input from the user. The input we take from the user is read as string by default. After giving input we have to press “Enter”. Then only the input() function reads the value entered by the user.
The syntax of input() function is:-
e.g., string input
a=input("Enter your name:") print(a)
e.g., integer input
a=int(input("enter your roll no.:")) print(a)
The input we take from the user is treated as a string by default. So if we want to do operation of integer and float type with it then we have to convert it into integer or float.
It does not seem a problem for printing it. But when we do arithmetic operation on it, it will show an error. The error is a TypeError can’t convert int to str.
This is how we take input from the user in python.