Topic: Input in python
Python input() Function
Python input() function is used to get input from the user. It prompts for the user input and reads a
line. After reading data, it converts it into a string and returns that. It throws an error EOF Error if
EOF is read.
Parameters
prompt: It is a string message which prompts for the user input
Return
It returns user input after converting into a string.
Let's see some examples of input() function to understand it's functionality.
Python input() Function Example
Example: Using input() to get user's name and age
name = input("Enter your name: ")
age = input("Enter your age: ")
print("Hello, " + name + "! You are " + age + " years
old.")
Output:
Enter you name:
Enter Your age: