input() (Python)

input() pauses the program and waits for the user to type something, then returns what they typed as a string. You can pass a prompt message to display first.

Python

Because input() always returns a string, you often wrap it in int() or float() when you need a number.

Syntax

input(prompt)

Examples

Python

name = input("Your name: ")
print("Hi", name)

Output:

Your name: Sam
Hi Sam

Learn it in a lesson

See also

Back to the Dictionary