voidex/20-29 Areas/20 Programming/20.01 Python/input().md

735 B

title tags aliases
input()
python
functions
input
input
input-function
user-input

[!note] Concept
The input() function waits for the user to type text and press ENTER, then returns it as a string.

[!example] Example

myName = input()

If the user types Al, the result is equivalent to:

myName = 'Al'

[!important] Best Practices

  • Always assume input() returns a string — cast with int(), float(), etc. if needed.
  • Only use input() in Python 3. In Python 2, use raw_input() instead.

[!info] Related Notes
typeConversions
functions
pythonSyntaxOverview