If you went through the cursus of preparatory classes (CPGE), you most certainly have been confronted to the Python programming language already. If not, we recall here some elements of the language to help you write a small program quickly.

Important! This page is intended as a recap of some elements that are assumed to be previously studied. If you are in a different situation (e.g., you followed a cursus without courses on Python), you should carefully read some tutorials online. There are numerous well-made resources, such as Open Classrooms (in French) or Learn Python.

The specificities of Python

Presentation of the language

Python is a programming language with a simple syntax, i.e., writing programs in that language is generally easy and intuitive. This aspect of the language (among other reasons) makes it an ideal choice for prototyping (quickly testing an idea) or learning how to program.

In addition to that, Python is a complete programming language, widely supported by a large community of programmers (which means you will find people to answer your questions), and used a lot both in academy and industry. Due to this large support, it features numerous functions that can provide solutions to the problems you want to solve.

An interpreted language

There are two main categories of programming languages: those that are compiled, and those that are interpreted:

  • Programs written in languages that are made to be compiled (e.g., C++) are not evaluated directly by the computer. They will first go through a compilation step, in which a compiler will transform the source code you write into a binary code, directly understandable by the machine.
  • Those written in an interpreted language (e.g., Python, although in practice it is slightly more complex than that) are not transformed before their execution, and are not directly executed on the machine. Instead, they are fed to an interpreter, which is a program running on the machine that will read the instructions written in your code, and apply them.
  • Finally, there are numerous languages that are hybrids between compiled and interpreted ones. We will not cover that here.

Since Python is a widely supported language, there are numerous resources online or on paper to help you learn programming/debug your codes. Here are two more useful links that you should keep somewhere, as you will most probably need them at some point of this course:

These two links are definitely the most useful ones when it comes to debugging your code. In addition, it is worth noticing that there is a large diversity in available supports for Python, including MOOCs, smartphone apps, Youtube channels, … Choose the one that fits you best!