input()

The built-in function that shows a prompt, waits for the user to type a line and press Enter, and returns what they typed as a string.

In more detail

input always returns a string, even when the user types digits, so convert with int() or float() before doing arithmetic. The prompt argument is printed without a newline, so end it with a space.

Example

age = int(input("Age: "))

Related terms

Taught in

References

Certification courses