Skip to main content

Introduction and Setup

Python, is one of the most widely used programming languages in the world today. Its syntax is relatively easy to understand and there's a large number of libraries that offer a multitude of functionality. A versatile language, it can be used across many areas of software development, from basic scripts, simple to advanced backend (server-sided) web applications, blockchain development, data science and Artificial Intelligence amongst others.

Python was created by Guido van Rossum (a Dutch Developer) way back in the 1990's and fits across many programming paradigms , procedural, functional, object orientated... It is this flexibility and simplicity that bring us to learn it.

Python comes in different flavours. The most common Python is CPython, with a core written in the 'C' language, and some core modules written in Python itself. For a roundup of the different flavours see Python Flavours

Everything in Python is an object, variables, functions, classes, everything.

We write code for Python in files with the extension .py. As a semi-interpreted language, when Python code is first run it is converted into compiled bytecode in files with the extension .pyc. The interpreter does not interpret our .py files it interprets the compiled .pyc files using the Python Virtual Machine (pvm). Therefore, to use Python we need to install the Python Virtual Machine, which we just think of as installing Python.

Installing Python

Follow the setup instructions to install the Python interpreter (version 3.10 or greater) from https://www.python.org/downloads/.

There are numerous Interactive Development Environments (IDEs) that can be used to help us develop in Python. One of the best known and widely used being Pycharm, there are free student and community editions available online at https://www.jetbrains.com/pycharm/. If you do not wish to use Pycharm, you may use another IDE of your choice.

Once you have decided on and installed your preferred IDE, make sure it is using a version of as described above.

When we write code using an IDE in a .py file and then run it, the IDE will, in the background, invoke the python interpreter to process our code and execute it. All IDEs that cater for python will automatically generate the .pyc file containing bytecode. This is the file that will now be taken, line by line, by the interpreter and converted into machine code that runs on your computer.

Setting up our learning project

Open your IDE and create a new Python project (Using PyCharm - from the menu File > New Project > Pure Python).

NOTE: For an introduction to the Python interpreter and how to use it, refer to Python Docs.

We also encourage you to study the Python coding style guidelines here PEP8