provide build-in function input() to take input or data from the user at the runtime of the program. python have print() function for display the data and input() for get the data, but here input() function have a capability of display and get the data from user side simultaneously.
Syntax : var=input([argument])
here argument is optional and var is a variable name.
program to take input -
- 'a' is a variable and data type depends on input function. In python language we do not require to initilize the data type of the variable in our programming.
-term 'type' is use to identify the type of varible that in which class it belongs and in case of input() in python its type is 'str'. so for converting the string type to numeric type we do type casting here.
-In this program first it display the output to the user screen that 'enter something' when user insert data then input() function store the data and refered to variable 'a' then it display the value of a by print() function and in case of last input it get number but it actually behave as a string so we use int for type casting.