ProceduralOCR J277
DashboardCoursePracticeReviewProgressGlossary
Saved on this deviceContinue learning

Procedural · OCR J277 programming practice

Progress stays in this browser unless you export it.

Course/Input/Getting user input
J277 · 2.2.1

Unit 3 · Lesson 1

Getting user input

Lesson progress0 / 7

Build the idea

Start with the concept and its key vocabulary.

Key idea

Use input() to receive and store a user's response.

input() pauses the program and waits for the user to type. Assign its result to a variable so later instructions can use it. The words inside input() are the prompt shown to the user.

Input

Data received by a program, for example from a user, file or sensor.

Prompt

The message that tells a user what to enter.

Return value

The value produced by an instruction such as input().

Keep these in mind

  • Store input with an assignment.
  • A clear prompt tells the user what to type.
  • Python input always arrives as a string.

Learning objective

Use input() to receive and store a user's response.

Exam tip

When identifying an input, name the raw data received — for example, 'the player's name' rather than simply 'player'.

Common mistake

If the result is not assigned to a variable, the program receives the input but has no useful name for it later.

PreviousNext