liveBook · Manning

Read-execute-print loop

As explained in A Pythonic Adventure: From Python basics to a working web app

A REPL is an interactive programming environment that repeatedly reads input, evaluates it, displays results, and waits for more input.

A REPL is an interactive Python environment that reads your code, evaluates it, prints the result, and waits for the next command. It is a friendly place to try small ideas before adding them to a program. section 3.0

In the Mu editor, a REPL lets you:

  • Run expressions such as print('hello world') and 2 + 2. section 3.0
  • See numbered inputs such as In [1] and results such as Out[2]. section 3.0
  • Test functions and inspect values such as string and list lengths. section 3.0 section 3.1

Try a few commands

Type 2 + 2 to get 4, then try len('abcd') to get 4. You can also assign s = 'hello' and ask len(s), or create n = [1, 2, 3] and ask len(n). section 3.0

Use the REPL when a program needs a quick experiment. For example, testing len(title) * '-' shows how to create a divider whose length matches a menu title. section 3.0

How A Pythonic Adventure: From Python basics to a working web app covers it

How deep it goes
Explains the read–evaluate–print cycle through prompts and examples, but stops short of implementation internals.
Examples
Demonstrates print, arithmetic, string length, list length, repeated strings, and a menu-divider calculation.
What it assumes
Assumes basic Python expressions and variables while teaching interactive execution from concrete examples.
What you can do after
Apply it via Mu editor to test Python expressions, inspect values, and check functions before using them in a program.
How it connects
Connects interactive programming with Python expressions, functions, strings, lists, variables, and arithmetic.

Also explained in

Compare how 6 books explain read-execute-print loop →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of A Pythonic Adventure: From Python basics to a working web app. The section links point to the parts of the book it draws on.