Lesson 1 / 119%

Lesson 1

Introduction to Python

10 min

Understand what Python is, what it's used for and why it's an excellent first language.

Definition

Python is an interpreted and versatile programming language: it lets you write readable instructions that the computer executes to automate tasks, analyze data or build websites and applications. Unlike compiled languages, the code is not transformed in advance: a program called an interpreter reads it and executes it line by line. A Python file is launched withpython my_file.py.

What is Python?

Python is a programming language created in 1991 by Guido van Rossum, a Dutch computer scientist. It is known for its clear syntax, close to English, which makes it one of the best languages for beginners. Yet it is powerful enough to be used at companies like Google, Netflix or Instagram.

The name of the language does not come from the snake, but from the British comedy troupe Monty Python , of which Guido van Rossum was a fan. That is also why the official documentation often contains humorous references and why the Python community has a reputation for being welcoming.

A programming language is used to give precise instructions to a computer. Python is an interpreted language: you write your code in a file, and a program called the interpreter reads it and executes it line by line, with no prior compilation step.

How does a Python program work?

A Python program is simply a text file whose name ends with.py. When you run this file, the interpreter reads each line from top to bottom, translates it into instructions your machine can understand, then executes it immediately. If it encounters an error, it stops and displays a message that indicates the line concerned.

By contrast, languages like C or Rust are called compiled : the code must first be transformed into an executable file before being run. This step often makes the program faster, but development takes a little longer. Python favors simplicity and speed of writing.

Here is what the simplest possible program looks like. It displays a message on the screen using theprint() function:

print("Hello, world!")

What is Python used for?

Python is a general-purpose language: it can be used in almost every area of computing. Here are the most common uses.

  • Automation : renaming hundreds of files, sending emails, processing spreadsheets in a few lines.
  • Data and artificial intelligence : data analysis, charts, machine learning (pandas, NumPy, scikit-learn...).
  • Web development : building websites and APIs with Django, Flask or FastAPI.
  • Scripts and tools : small utilities, games, Discord bots, cybersecurity...
  • Science and research : scientific computing, simulations, image processing, bioinformatics.
  • Education : Python is the introductory programming language in many high schools and universities.
Python uses

Who uses Python?

Python is one of the most popular languages in the world. Google uses it for some of its services, Netflix for its analysis and recommendation tools, Instagram for its infrastructure, and NASA for scientific calculations. Thousands of developers, researchers and analysts use it every day, which guarantees a huge community, plenty of tutorials and thousands of free libraries.

The strengths and limits of Python

No language is perfect. Here is what makes Python strong, but also what you should know before diving in.

  • Readable : the code looks like simple sentences and indentation forces you to write cleanly.
  • Quick to write : a Python program is often much shorter than its equivalent in another language.
  • Rich in libraries : for almost every need, someone has already written a module you can reuse.
  • Slower to run : for very heavy calculations or complex 3D games, compiled languages are better suited.

Python 2 or Python 3?

Python 2 has not been maintained since 2020. In this course, we use exclusively Python 3 , the current version of the language. If you see a tutorial that usesprint "hello"without parentheses, it is Python 2: do not use it. In Python 3, you always writeprint("hello").

Good to know

Python is not a "kids' language": its simplicity is a design choice. The same concepts you will learn here (variables, conditions, loops, functions) are found in all other languages. Once you have mastered Python, learning JavaScript, Java or C becomes much easier.

What you will learn in this course

You will install Python, write your first program, work with variables and data types, make decisions with conditions, repeat actions with loops, organize your code with functions, then discover lists, dictionaries, modules and error handling.

Each lesson follows the same logic: a short explanation, examples you can copy and test, then an exercise to practice. The most important thing is to practice : type the code yourself rather than just reading it, and do not be afraid of error messages. They are part of learning and help you understand what is going on.

Exercise

Think of a repetitive task you do on your computer (renaming files, copying data, calculating totals...). Write it down: by the end of the course, you will have the basics to automate it. Also write in one sentence what you would like to create with Python (a website, a game, a tool, a data analysis): this goal will guide you throughout your progress.