Pythondex

Tutorial

User Input in Python

In Python, you can get input from the user using the input() function.

Basic Usage

Explanation

  • input() pauses the program and waits for the user to type something.
  • The text inside " " is shown as a prompt to the user.
  • The value entered by the user is returned as a string and can be stored in a variable.

Example

input() always returns a string. Use int() or float() to convert numeric input.