The REPL: a Python Scratchpad
Scenario: You want to test one calculation without creating a project.
New words, in plain English
- REPL - Read-Evaluate-Print Loop: an interactive Python prompt
- Expression - code that produces a value
- Prompt - the
>>>marker asking for input
At >>>, enter one expression at a time. Python reads it, evaluates it, prints the result, and loops. Leave with exit() or Ctrl-D.
Analogy: A Python program is like a clear set of instructions for a careful helper: names label things, indentation groups steps, and errors explain where the helper became confused.
A small, real example
>>> 6 * 7
42
>>> "shell".upper()
'SHELL'
Tip: Use the REPL for questions; use a file for work worth keeping.
Goal: Practice this idea in the py-variables-types challenge at/labs/python. Fix the broken program, run it yourself, then usecheckto prove the real end state.