The Python REPL (CLI)

https://en.wikipedia.org/wiki/Command-line_interface
Command-line interface

https://problemsolvingwithpython.com/
Problem Solving with Python (book).

CONCEPTS

INTRODUCTION

A command-line interface (CLI) processes commands to a computer program in the form of lines of text. The program which handles the interface is called a command-line interpreter or command-line processor.

An operating system CLI: UNIX/Linux (sh, ksh, csh, bash, tcsh, etc.), Windows (CMD.EXE, Power Shell).

An application CLI: Gnuplot, GNU Octave, MATLAB.

A language CLI: Python, Forth, LISP, Rexx, BASIC.

REPL (read-eval-print loop) or a language shell, is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user. The Python REPL (the Python prompt) can be used as a calculator.

A command prompt (or just prompt) is a sequence of (one or more) characters used in CLI to indicate readiness to accept commands [Python (>>>), Linux ($ or #), Windows (>)].

DEBIAN 10


$ python             # run Python 2, the same for 'python2' or 'python2.7'
Python 2.7.16 (default, Oct 10 2019, 22:02:15) 
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 23 + 34     # comments after '#' are ignored
57
>>> _ + 12      # '_' (underscore) keeps the last result (read-only)
69
>>> a = 2 ; b = 5     # two statements are separated by ;
# results of assignments are not printed
>>> a * b
10
>>> 1 + 2 + \       # breaking the line with the backslash ...
... 4 - 3                     # ... continued
4
>>> (10 + 12 +     # open "(" or "[" or "{" is more readable
... 13)                     # ... continued
35
>>> [Ctrl]+[d]     # or quit(), the end of the work 
$                          # back to the shell

$ python3     # the same for 'python3.7'
Python 3.7.3 (default, Jul 25 2020, 13:03:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> for i in [1, 2, 3]:   # a compound statement
...     print (i)
...                      # an empty line required
1
2
3
>>> import math      # math functions and constants
>>> help(math)       # exit with [q]
>>> help(math.sin)
>>> math.pi
3.1415926535897931
>>> math.sqrt(2) / 2.0   # using dot
0.70710678118654757
>>> [Ctrl]+[d]     # or quit(), the end of the work 
$                          # back to the shell

WINDOWS 10

Open 'Command Prompt' (cmd.exe) or 'Windows PowerShell' and run Python.