Python Programming

Python is an object-oriented programming language that has an easy syntax and high-level mechanisms for handling data.

I do not provide a book about Python, but on this page you can find links to Python versions of the programs that are presented in my programming books. The Python programs contain comments that should help you to get some basic information about the Python programming language.

The following links are useful when you study Python programming:

This page was renovated in December 2022. The programs in the table were converted to the modern Python 3 syntax, and can now be compiled with the latest Python compiler/interpreter.


 

The pictures below are obtained from a fan site of a British comedy group named Monty Python's Flying Circus. The "father" of the Python programming language is a Dutch man named Guido van Rossum, and he is a great fan of the mentioned comedy group. He named his programming language after his favourite comedians.


 

Python installation and execution of programs

To make the installation, you should go to python.org and download a free installation file for your operating system, and do the installation. On Windows, it is important that you tick a box about creating the Path for Python.

To execute the Python program Game.py on macOS systems, you need to open a Terminal window and go to the folder (directory) where you have put the Game.py file. Then you can type the command

python3 Game.py
      

which executes (or interprets) the Python program that is stored in file Game.py. (I use the word "interpret" when I'm writing about Python programs because Python programs are scripts that are not compiled in the traditional way. When a Python interpreter executes a program, the compilation and execution activities are carried out as a single process.)

If you are usign a Windows computer, you can run the Python program Game.py  in the following way in a Command Prompt window:

C:\>D:

D:\>cd programs

D:\programs>cd pythonfiles2

D:\programs\pythonfiles2>python Game.py
      

In the above case Game.py was in the folder D:\programs\pythonfiles2.

You can edit Python programs with some free editor (e.g. Notepad++) in Windows.

python.org provides a lot of documentation related to Python. Some of these documents are installed to your Windows computer when you install the compiler.