0Pricing
Python Academy · Lesson

Reading User Input

Use the input() function to read data from users and process it.

Introduction

The input() function pauses your program and waits for the user to type something, then returns it as a string.

Basic input()

name = input('Enter your name: ') The prompt string is optional. The function always returns a str.
# name = input('Your name: ')
name = 'Alice'  # simulated
print('Hello,', name)

All lessons in this course

  1. Variables and Assignment
  2. Numeric and Boolean Types
  3. Strings and Type Conversion
  4. Reading User Input
← Back to Python Academy