Explain it simply
Explain it simply
Python is a programming language: a precise way of telling a computer what to do. Its code reads almost like English, which is why so many people choose it as their first language. It is not a toy, though. Large web back ends, the notebooks data scientists use for analysis, and the scripts that train AI models are commonly written in Python.
This course starts from zero. The first lessons teach you to store values, make decisions and repeat work. Later ones build up, step by step, to files, databases, web APIs and complete projects.
Problem → Why → Solution
The problem: learning in random order
Many beginners watch one video about a Django website and another about pandas charts, then copy the code. They get stuck at the very first error because nobody explained what a NameError is or why indentation matters. The code below is the kind of thing a beginner writes: the first line works and the second one crashes.
print("Starting my program")
Print("Total:", 2 + 3) # NameError: name 'Print' is not defined
print("Done") # never runsWhy does it stop there?
Python runs a file from top to bottom, one statement at a time. There is no name called Print with a capital P, so line 2 raises an error and the program stops; "Done" is never printed. Once you have learned the basic rules in order, you can read an error message like this and fix it yourself, which is exactly why the course starts with the fundamentals.
Core concept: what Python is and how the course is built
A Python program is a plain text file whose name ends in .py. A program called the interpreter (you start it with the python command) reads that file and runs its statements from top to bottom. There is no separate step that produces an .exe file, so you can edit the code and run it again immediately. This course teaches Python 3. Python 2 stopped receiving support in 2020, so if you find code online such as print "hi" without parentheses, it is outdated Python 2 code.
Python is pleasant to work with because of three layers. First comes the language itself: the grammar of variables, if, for, functions and classes. Second is the standard library, modules such as math, json, sqlite3 and pathlib that ship with Python, so you only need to import them. Third are third-party packages such as NumPy, pandas, Django and requests; other people write them, you install them separately with pip, and they have their own version numbers. When you hit an error, knowing which layer it comes from is half of the fix.
The 70 lessons are split into five chapters. Basic is the foundation; Intermediate organises code and connects it to files and libraries; Advanced covers the tools professional developers use every day. Projects and Exercises are where you combine everything. Each chapter builds on the one before it, so working through them in order pays off.
| Chapter | Lessons | What you learn |
|---|---|---|
| Basic | 19 | Syntax, comments, variables, data types, strings, operators, lists, dicts, if, loops, functions |
| Intermediate | 22 | OOP, exceptions, debugging, file handling, NumPy, pandas, SciPy, Django |
| Advanced | 22 | Decorators, generators, comprehensions, APIs, JSON, SQLite, testing, venv, pip |
| Projects | 5 | Calculator, to-do list, weather app, web scraper, Flask REST API |
| Exercises | 2 | Two mixed practice sets for basic and intermediate topics |
- Write code in a .py file
- Run it with python file.py
- The interpreter goes top to bottom
- print() shows output; errors stop it
Output printed before the failing line is still visible, so it tells you how far the program got.
General pattern: the shape of a tiny program
# 1. store values under names
name = value
# 2. compute something new from them
result = name + other_value
# 3. show it
print("label:", result)Most tiny programs follow three steps: store values under names, compute a new value from them, and show it with print(). Give print() several comma-separated arguments and it prints them with one space between each.
Example: your first program
Save this code as first_program.py and run python first_program.py in a terminal (python3 on macOS and Linux). Before you run it, write down on paper what each print line will show, then compare with the real output. Doing this in every lesson is the fastest way to get good at reading code.
# first_program.py - run it with: python first_program.py
course = "Python"
lessons = 70
chapters = ["Basic", "Intermediate", "Advanced", "Projects", "Exercises"]
print(f"Welcome to the {course} course!")
print(f"{lessons} lessons in {len(chapters)} chapters")
print("First chapter:", chapters[0])
print("2 + 3 =", 2 + 3)Code breakdown
- Line 1
# first_program.py - run it with: python first_program.pyA line starting with # is a comment. Python skips it entirely; it is only there for people reading the file.
- Lines 2-3
lessons = 70= attaches the value on the right to the name on the left. "Python" is in quotes, so it is text (a str); 70 has no quotes, so it is a number (an int).
- Line 4
chapters = ["Basic", "Intermediate", "Advanced", "Projects", "Exercises"]Square brackets [ ] create a list, an ordered collection of values. len(chapters) returns how many items it holds, which is 5.
- Line 6
print(f"Welcome to the {course} course!")The f before the quote makes an f-string. The value of course replaces {course}, so it prints Welcome to the Python course!.
- Line 8
print("First chapter:", chapters[0])List positions are counted from 0, so chapters[0] is the first item, "Basic". print() puts one space between its two arguments.
- Line 9
print("2 + 3 =", 2 + 3)The quoted "2 + 3 =" is printed exactly as written, while the unquoted 2 + 3 is calculated first and prints 5. Quotes change what kind of value you have.
Welcome to the Python course!
70 lessons in 5 chapters
First chapter: Basic
2 + 3 = 5How to work through each lesson
Every lesson follows the same rhythm: a plain explanation, a real problem, the concept, a runnable example, common mistakes, a mini challenge and a short quiz. To get the most out of it, follow these steps.
1. Type the example yourself
Typing instead of pasting trains your hands to remember colons, brackets and indentation.
2. Predict the output
Write your guess down before running. When it is wrong, you have found exactly what you misunderstood.
3. Change one value
Change lessons = 70 to 7, or chapters[0] to chapters[4], and predict the new result before running again.
4. Attempt the challenge before the solution
If you get stuck, read the hint first and open the solution last.
In real projects
Where Python shows up in real work
In web development, frameworks such as Django and Flask power website back ends and APIs; you will build with Django in the Intermediate chapter and a Flask REST API in the Projects chapter. In data analysis, pandas and NumPy filter and summarise spreadsheets with thousands of sales records in seconds.
Automation is another strength: renaming hundreds of files in a folder, producing a daily report or collecting data from a website (web scraping) takes only a short script. In AI and machine learning, libraries such as PyTorch use Python as their main interface. Whichever job you end up using Python for, the material in the Basic chapter will appear in your code every single day.
Common mistakes
Common mistakes
1. Following old Python 2 tutorials
Code such as print "Hello" without parentheses, or raw_input(), is Python 2. In Python 3 the first is a SyntaxError and raw_input() was renamed input(). When you read a tutorial, first check that it writes print() with parentheses.
2. Jumping to a framework before the basics
If you start with Django or pandas, you cannot tell whether an error comes from the framework or from Python itself. Getting comfortable with the variables, lists, dicts, loops and functions of the Basic chapter first makes framework code far easier to read.
3. Forgetting that Python is case-sensitive
Print, PRINT and print are three different names. Only print is the built-in function, so the others raise a NameError. Recent Python versions add a hint such as "Did you mean: 'print'?", so read the error message to the end.
Mini challenge
Mini challenge: your study plan
Write a program, study_plan.py, that works out how many weeks the course will take you and prints a short plan.
- Store your name, the total number of lessons (70) and how many lessons you will do per week in variables
- Divide the total by the weekly pace to get the number of weeks
- Print at least three lines using f-strings
# TODO: store your name
# TODO: store the total number of lessons in the course
# TODO: store how many lessons you plan to finish each week
# TODO: weeks = total lessons divided by lessons per week
# TODO: print a greeting that uses your name
# TODO: print the pace, e.g. "Pace: 5 lessons per week"
# TODO: print how many weeks it will takeExpected: With the sample values: Hi Aye, let's learn Python! Pace: 5 lessons per week You will finish all 70 lessons in 14 weeks.
Show hint
Dividing with / gives a decimal such as 14.0, while // gives the whole number 14. Try both and compare the output.
Show solution
learner = "Aye"
total_lessons = 70
per_week = 5
weeks = total_lessons // per_week
print(f"Hi {learner}, let's learn Python!")
print(f"Pace: {per_week} lessons per week")
print(f"You will finish all {total_lessons} lessons in {weeks} weeks.")Quick quiz 1 / 3
Quick quiz 2 / 3
Quick quiz 3 / 3
What to remember
- Python is widely used for web back ends, data analysis, automation and AI.
- The course splits 70 lessons into Basic (19), Intermediate (22), Advanced (22), Projects (5) and Exercises (2); take them in order.
- The language, the standard library and pip packages are three separate layers.
- The interpreter runs a file from top to bottom and stops at the first error.
- Predict the output of every example before you run it.
The Python Tutorial — Python Software Foundation