Getting Input from User in Python
To receive information through the keyboard , Python uses the built-in function input() . This function has an optional parameter, commonly known as prompt , which is a string that will be printed on the screen whenever the function is called.
Syntax
input(prompt)
Parameter - prompt: A String, representing a default message before the input.
inData = input("Type anything you want")
print(inData)
New line for input() in Python
When you run this program, the python ask the data to enter the same line. If you want to receive data on next line , put a "\n" inside of the quotes.
inData = input("Type anything you want : \n")
print(inData)
"\n" is a control character, sort of like a key on the keyboard that you cannot press.

Python Integer as the User Input
To capture the input in your program, you will need a variable. A variable is a container to hold data. The input() function , by default, will convert all the information it receives into a string. So, there is no way to get an integer or any other type as the user input. However, we can use the built-in functions to convert the entered string to the integer.
inData = input("Entere an integer value \n ")
inData = int(inData)
print(inData + 1)
Related Topics