Python input() Function

The input() function puts the user input into a variable.

Syntax

Python
input()
input(prompt)

Parameters

ParameterDescription
prompt Optional. If provided, this value is output (without a trailing newline) before input.

Example

Python
print('What is your name?')
name = input()
print(f'Hello {name}.')

Output

What is your name?
Marc      <-- This part I typed in and pressed the ENTER key.
Hello Marc.