Lesson 1 of 26 in Python for Beginners · 10m
What programming is and why Python
A computer is very fast and very literal. It does exactly what it is told, in exactly the order it is told, and nothing else. A program is a written set of those instructions. When you open a web page, check the weather or pay for something with your phone, programs are running: someone wrote down, step by step, what should happen.
People do not write those instructions in the computer's native language of numbers. They write them in a programming language, a precise, limited form of writing that both people and computers can read. Another program then translates it into something the machine can carry out. This course teaches one of those languages, Python, from the very first step.
You do not need to be good at maths, and you do not need to know anything about computers beyond how to open files and type. You need patience, curiosity and a willingness to make mistakes, because every programmer makes them all day long.
What Python is
Python is a general-purpose programming language created by Guido van Rossum, a Dutch programmer, who released the first version in 1991. It is free and open source, and today it is developed by a community of volunteers and overseen by the Python Software Foundation.
Three things make Python a popular first language:
-
It reads almost like English. A line such as if age >= 18: means what it looks like it means. There is little punctuation to trip over.
-
It gives quick feedback. Python is usually run by an interpreter, a program that reads your code and carries it out straight away. You can type one line and see the result immediately, which is ideal for experimenting.
-
It comes with a lot built in. The standard library, which is installed along with Python, has ready-made tools for maths, dates, files, random numbers, web addresses and much more. Thousands of extra packages cover everything else.
Python is not a toy for beginners, though. The same language is used by professional software engineers, scientists and analysts every day.
What people use Python for
Because it is general-purpose, Python turns up almost everywhere:
-
Automating boring tasks: renaming hundreds of files, tidying spreadsheets, sending reports.
-
Data analysis and science: cleaning data, calculating statistics, drawing charts, running experiments.
-
Machine learning and AI: many of the most widely used AI libraries are used from Python.
-
Web development: frameworks such as Django and Flask run the server side of websites.
-
Teaching and research: universities use it to teach programming and to run simulations.
This course focuses on the core language that all of those build on. Once you are comfortable with it, moving into any of those areas is mostly a matter of learning a few extra libraries.
A short history of Python
- 1991: First public release Guido van Rossum publishes Python 0.9.0.
- 2000: Python 2.0 Adds features such as list comprehensions and a new garbage collector.
- 2008: Python 3.0 A cleaned-up version of the language that is not fully compatible with Python 2. This is the Python you will learn.
- 2020: Python 2 retired Python 2 stops receiving updates on 1 January 2020. All new code should use Python 3.
- 2023: Python 3.12 Better error messages and more flexible f-strings. This course targets 3.12 and later.
- Each October: A new 3.x release A new version of Python 3 now comes out every year, and each one is supported with bug and security fixes for about five years.
How this course works
The course has six sections. You will start by installing Python and running your first lines. Then you will learn how Python stores data, how it makes decisions and repeats work, how to organise data in collections, and how to package code into functions and deal with errors. The final section covers modules, files, virtual environments and a first look at classes, and ends with two complete projects.
Every lesson follows the same pattern: a short explanation, small examples, and something for you to try. Code appears in boxes like this:
print("Hello, world!")
When a lesson shows what a program prints, the output appears in a second box straight after the code. Every one of those outputs is exactly what Python prints, checked by running the code with Python 3.12 and newer versions.
A few habits will make a big difference:
-
Type the examples yourself. Copying and pasting is faster, but typing builds the muscle memory and makes you notice details such as brackets and colons.
-
Change things and see what happens. Swap a number, remove a bracket, rename a variable. Breaking code on purpose is one of the fastest ways to understand it.
-
Read error messages instead of fearing them. An error is Python telling you, quite precisely, what confused it. Section 5 shows you how to read them.
-
Practise little and often. Twenty minutes a day beats three hours once a week, because programming is a skill, like a language or an instrument.
-
Build small things. As soon as you can, write tiny programs for your own life: a tip calculator, a quiz, a script that renames your photos.
Key takeaways
- A program is a precise list of instructions; a programming language is a way of writing them that people and computers can both read.
- Python is a free, general-purpose language first released in 1991, known for readable code and a large standard library.
- Always use Python 3. Python 2 stopped receiving updates in 2020.
- Type examples yourself, experiment, read error messages and practise little and often.
Sources
- Python Software Foundation: About Python
- Python documentation: History and license
- PEP 602: Annual release cycle for Python
- Sunsetting Python 2
This lesson also has interactive exercises. Open the course to try them and track your progress.