Python input() Function
The input() function puts the user input into a variable.
Syntax
Python
Copy Code
input() input(prompt)
Parameters
Parameter | Description |
---|---|
prompt |
Optional. If provided, this value is output (without a trailing newline) before input. |
Example
Python
Copy Code
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.