In this tutorial, we will learn about the python input and output functions.

The input function is used to input the user and store it into variables. Input function can store a string or a numeric value.
The Input function can be defined with the input() function.
Syntax for input:
Syntax of output:
As we can see in the above syntax, first, we declare a variable, then assign the input function to that variable, and in between brackets, we add a string as a message which will be print when we run the program. By default, I will store all the given values in a String. If we want to take value in integer, we need to use int() function and float, and we need to use float() function.
Example:
Output:
Let run it one more time and use string as an input.
Output:
As you can see, we don’t need to specify any data type in the input function; it will store what every user has given.
Example:
Output:
Here we ask the user to enter a number, and then the input function is storing it in a variable as an integer using the int() function.
Example:
Output:
Here we are storing a value into a float.
How the input function works in Python:
- When the input() function is called at the time of the program’s execution, it will stop the program’s flow until the user has given any input in a string or numerical.
- The text or message displayed on the output screen to ask a user to enter the input value is optional, i.e., the prompt printed on the screen is optional.
- Whatever you enter as input, the input function converts it into a string. If you enter an integer value, the still input() function converts it into a string.
Example 3:
Output:
Example 4:
Output:
As we can see here, we have used two input functions, and we can use as many as we need.
Operations using the input function
We can also do different operations using operators like Addition, substation, and many more.
Let take an example with the python operator.
Example 5:
Output:
In the same way, we can also create our calculator program using python.
Example:
Output:
We hope you have learned about what python input output function is.