User input

accepting data from a user in a Python program

To accept data from a user in a Python program, we can assign a variable with the input() function and place a prompt inside the brackets:

name = input("What is your name? ")

Last updated