In the example above, we used the input() function twice to get our user’s name and age.
myName = input("Please enter your name: ")
The string “Please enter your name: ” is the prompt that will be displayed on the screen to give instructions to the user. After the user enters the relevant information, this information is stored as a string in the variable myName. The next input statement prompts the user for his age and stores the information as a string in the variable myAge.
The input() function differs slightly in Python 2 and Python 3. In Python 2, if you want to accept user input as a string, you have to use the raw_input() function instead.