4. The Python REPL

4.1. Introduction

In this chapter, you will learn how to write and run your first lines of Python code at the Python REPL also called the Python prompt. You will learn how to use Python as a calculator and be introduced to Python variables and Python’s print() function.

By the end of this chapter, you will be able to:

  • Open and close the Python REPL

  • Compute mathematical calculations using the Python REPL

  • Use the output from the Python REPL as input in another problem

  • Import the math and statistics modules from the Python Standard Library and use their functions

  • Assign values to variables

  • Use variables in calculations

  • Create strings

  • Combine and compare strings