Pulsars
0 %
Log inSign up

Discovering Python

Why Python and how to use it

Why learn Python?

Python is a programming language created in the late 1980s, which has become one of the most widely used languages in the world today, both for learning and for professional projects (artificial intelligence, websites, data science...).

It is particularly well suited for beginners, because:

  • its syntax is close to natural language (few complicated symbols),
  • it doesn't need a separate compilation step: you write the code, and run it directly,
  • a huge community offers help and ready-made libraries.

To write and run Python code, you need an interpreter: a program that reads your Python code line by line and executes it immediately. This is very different from a language like C, where you first have to compile (translate) the whole program before you can run it.

You can use Python in two main ways:

  • in interactive mode (also called console or shell): you type an instruction, press Enter, and the result appears immediately. This is ideal for quickly testing an idea.
  • by writing a file (with the .py extension), which you then run all at once. This is what you'll do for most of your programs.

To run a file named mon_programme.py from a terminal, the command is:

python3 mon_programme.py

In the rest of this course, you will gradually discover Python's syntax, starting with the very first reflex of every programmer: displaying a message on the screen.