Python Input Exercises

Let’s check out some exercises that will help you understand Python’s input() function better.

Exercise 13-a

Using input() function ask for user's name.


input() function will return whatever user enters after its prompt. Inside input() function’s parenthesis you can type your message which will be shown to the user:
input(“message or question”)

ans_1 = input("Please enter your name.")

Exercise 13-b

This time ask the user a numerical question, such as, "Please enter your age." See what type of data input() returns.


input() function will always return string type data.

ans_1 = input("Please enter your age.")