Input and Output

Input

Use input() to get user input:

name = input("What is your name? ")
print(f"Hello, {name}!")

Output

Use print() to display output (see the Printing Text lesson for more details).


Try asking the user for input in your own programs!


← Previous: Dictionaries and Sets Next: Modules and Packages →