About Python
Python is a popular computer language, suitable for solving many types of problems. Compared to other languages, Python is known for being programmer efficient — allowing the programmer to specify what they want pretty easily, perhaps at the cost of running a little slower or using more memory.
The style of Python code is minimal, not requiring the programmer to type in a lot words. Python has as satisfying consistency, with its features working logically and consistently across many situations.
Open Source
Python is distributed for free as open source software. This means many people and organization contribute code to make Python work, and it is free for anyone to use.
The official web site for Python information is python.org. Python was created in 1991 and for many years was run by Guido Van Rossum, who is kind of a rock star in the CS world.
How Does Python Code Run?
The code of a Python program is stored as plain text in a file with a name like 'main.py'. How does the Python code run on the hardware in a computer? The CPU chip in a computer runs its own "machine code" which is different from Python code. To run Python code, a separate "Python Interpreter" program runs on the CPU directly. The interpreter then looks at the Python code in, for example 'main.py', going through the lines and performing the actions specified on each line. In this way, the interpreter "runs" the Python code.
Interactive Interpreter >>>
It's also possible to run the interpreter interactively, typing bits of Python code into the interpreter to see what they do (see also interpreter chapter). The >>> is the interpreter prompt; type in some Python code (shown in bold), and on the next line the interpreter shows the result of running that code, a so called read-eval-print-loop or REPL.
>>> 100 + 21 121 >>> 2 ** 5 32 >>> 'hi' + 'there' 'hithere' >>>
Cross Platform
Python code is cross-platform, meaning a python program developed on Mac OS X, can likely also run on Windows or Linux without any change to the code. The Python interpreter has extra logic in it to translate where necessary each Python line to the appropriate Mac or Windows or whatever facility for that line. In this way, the programmer is insulated from many platform-specific details. They can run and debug their code on their code on their platform of choice, and with rare exceptions, it should run the same on other platforms.
Python Version 3
We will use Python version 3 in this course. Python version 3 made some changes vs. Python 2.x, in particular changing strings to be unicode, and the print() function to be a function. For the most part, Python 2.x code looks very similar to Python 3.x code. So working in both versions is not a big issue. That said, use of Python 2.x in the world is now dying out.
Copyright 2025 Nick Parlante