Introduction to Python
Python is a programming language: a precise way of writing instructions for a computer. It was created by Guido van Rossum and first released in 1991, and today it is one of the most popular languages in the world.
Why learn Python?
- It reads almost like English. Python was designed to be easy to read, so you spend your time thinking about the problem, not fighting the syntax.
- It is everywhere. Websites (Instagram, Pinterest), data science, artificial intelligence, automation scripts, games, science and finance all use Python.
- It has a library for nearly everything. Need to analyse a spreadsheet, build a website or train a machine-learning model? Someone has already written a well-tested library for it.
A few of the tools that open up once you know Python:
| Area | Tools |
|---|---|
| Websites and APIs | |
| Data | |
| AI and machine learning |
Your first taste
Here is a complete Python program. Press Run to run it right here in your browser.
print("Hello, world!")
print("Python is", 2026 - 1991, "years old.")The first line prints a message. The second line prints some text and the result of a calculation: Python works out 2026 - 1991 before printing it.
Now press Edit, change the message to your own name, and run it again. You cannot break anything here; if it goes wrong, press Reset.
How Python runs your code
Python is an interpreted language. When you run a program, the Python interpreter reads it from top to bottom and carries out each line in order. That means:
- You can run a program the moment you write it; there is no separate compile step.
- If line 5 has a mistake, lines 1 to 4 still run before Python stops and tells you what went wrong.
print("This line runs first")
print("Then this one")
print("And this one last")What you will learn in this course
You will start with variables, numbers and text, then learn to make decisions, repeat work with loops, organise data in lists and dictionaries, write your own functions, handle errors, and finally build your own classes. Each lesson is short and ends with a quick check.