Python input() function

Example

Request the user's name and print it out:

print('Enter your name:')
x = input()
print('Hello, ' + x)

Run Instance

Definition and Usage

The input() function allows users to input.

Syntax

input(prompt)

Parameter Value

Parameter Description
prompt String, representing the default message before input.

More Examples

Example

Usage prompt Write a message before inputting the parameter:

x = input('Enter your name:')
print('Hello, ' + x)

Run Instance