Complete free Python course in one page: 12 structured modules with tested code and real output, a stage-by-stage roadmap, an 80-topic checklist, three practice projects, the five errors every beginner hits (with the exact messages), and our downloadable notes PDF — plus the best genuinely free Python books, legally linked. One honest line before we start: we don’t host paid courses or pirated books here; everything linked is officially free from its author or publisher.
Bookmark this page — it’s built to be your home base from your first print() to your first real project. Every code block below was executed before publishing; the output you see is the output you’ll get.
The Python Roadmap — Beginner → Intermediate → Advanced

The 3-stage Python roadmap — save it, follow it.
Complete Python Topics Checklist (Save This)
Everything Python-core in one list — tick topics off as you learn them. This checklist is also inside the PDF at the end, print-ready.
🟢 Beginner — the foundation (25 topics)
- Installing Python & PATH
- Running .py files / IDLE / VS Code
- print() & comments
- Variables & naming rules
- Data types: int, float, str, bool
- Type conversion (int, str, float)
- input() — and why it returns str
- f-strings & string formatting
- Arithmetic operators (+ − * / // % **)
- Comparison operators (== != > <)
- Logical operators (and, or, not)
- if / elif / else
- Nested conditions
- for loops & range()
- while loops
- break & continue
- String methods (upper, strip, replace, split)
- String slicing [start:end:step]
- Lists: create, index, append, remove
- List slicing
- Tuples & unpacking
- Sets & uniqueness
- Dictionaries: keys, values, get()
- Looping over dicts & lists
- len(), min(), max(), sum()
🟡 Intermediate — real programs (24 topics)
- Functions: def, return
- Parameters, defaults, keyword args
- *args & **kwargs
- Variable scope (local vs global)
- List comprehensions
- Dict & set comprehensions
- lambda functions
- map(), filter(), sorted(key=…)
- File handling: open modes w/r/a
- with statement (context managers)
- Working with CSV files
- try / except / else / finally
- Raising exceptions (raise)
- Common exceptions (ValueError, TypeError, KeyError)
- Modules & import styles
- Standard library tour: math, random, datetime, os
- pip & installing packages
- Virtual environments (venv)
- requests basics (calling an API)
- JSON: loads & dumps
- String ↔ date conversion (strftime/strptime)
- Enumerate & zip
- Ternary expressions
- Docstrings & help()
🔵 Advanced-ready — professional Python (24 topics)
- OOP: classes & objects
- __init__ & self
- Instance vs class attributes
- Methods & method overriding
- Inheritance & super()
- Polymorphism
- Dunder methods (__str__, __len__)
- Generators & yield
- Iterators & iter()/next()
- Decorators
- Closures
- Type hints (def f(x: int) -> str)
- Regular expressions (re)
- Working with paths (pathlib)
- Error logging (logging module)
- Unit testing basics (unittest / pytest)
- Reading large files efficiently
- Date/time arithmetic (timedelta)
- Collections module (Counter, defaultdict)
- Itertools essentials
- Basic SQLite with sqlite3
- Structuring a project (folders, __main__)
- Reading documentation effectively
- Next steps: pandas / Flask / automation

The full 73-topic checklist — also inside the free PDF, print-ready.
The 12 Modules — Notes, Code & Real Output
Each module: the concept in plain words, a short program, its actual output, and one practice task. Run everything — reading is 20%, typing is 80%.
Module 1: Setup & Your First Program
Install Python from python.org (tick “Add to PATH” on Windows), open any editor — IDLE, VS Code, or even your phone’s Pydroid — and run your first line. If this prints, your setup works and everything below is open to you.
print(“Python version check done – you are ready.”)
Python version check done – you are ready.
✏️ Practice: change the message, run it again — you just edited a program.
Module 2: Variables, Data Types & Input
Variables are labeled boxes for data. Python figures out the type itself — string, integer, float, boolean — and f"..." strings let you drop variables straight into text. One trap to tattoo on your brain: input() always returns a string, even when the user types a number.
age = 21
height = 5.6
is_student = True
print(type(name), type(age), type(height), type(is_student))
print(f”{name} is {age} years old.”)
# input() always returns a string!
# age = input(“Your age: “) -> “21” (str), convert: int(age)
Ahmed is 21 years old.
✏️ Practice: take a friend’s name and birth year with input(), print their age (convert with int() first).
Module 3: Operators & If/Else Decisions
Programs become useful when they decide. if / elif / else walks conditions top to bottom and runs the first true branch. Alongside: // floor-divides, % gives the remainder, ** is power — three operators beginners meet in every exercise.
if marks >= 80:
grade = “A”
elif marks >= 70:
grade = “B”
elif marks >= 60:
grade = “C”
else:
grade = “F”
print(“Marks:”, marks, “| Grade:”, grade)
print(10 // 3, 10 % 3, 2 ** 5) # floor div, remainder, power
3 1 32
✏️ Practice: write a grading program for YOUR marks scheme, add an A+ branch.
Module 4: Loops — for & while
Loops repeat work so you don’t. for i in range(1, 6) counts 1 to 5 (range stops BEFORE the end number — remember this), while while repeats until its condition turns false. Every table, menu, and game loop you’ll ever write starts here.
for i in range(1, 6):
print(f”5 x {i} = {5*i}”)
# while loop
count = 3
while count > 0:
print(“Countdown:”, count)
count -= 1
print(“Done!”)
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
Countdown: 3
Countdown: 2
Countdown: 1
Done!
✏️ Practice: print the 7-times table, then a countdown from 10 that says “Liftoff!” at the end.
Module 5: Strings in Depth
Text is data you can operate on: change case, replace words, measure, slice pieces out with [start:end], and check membership with in. Strings are everywhere — user input, files, web data — so these few methods pay rent daily.
print(text.upper())
print(text.title())
print(text.replace(“easy”, “powerful”))
print(len(text), “characters”)
print(text[0:6]) # slicing
print(“easy” in text) # membership
Python Is Easy
python is powerful
14 characters
python
True
✏️ Practice: take a sentence and print it reversed (hint: slicing accepts a step — try [::-1]).
Module 6: Lists, Tuples, Sets & Dictionaries
Python’s four containers, one line each: list = ordered and changeable, tuple = fixed, set = automatic no-duplicates, dict = key→value lookups. Choosing the right one is half of clean Python — and dicts run the modern world (every API response is basically one).
point = (3, 5) # tuple – fixed
unique = {1, 2, 2, 3, 3} # set – no duplicates
student = {“name”: “Sara”, “marks”: 88} # dict – key:value
fruits.append(“orange”)
print(fruits)
print(point[0], point[1])
print(unique)
print(student[“name”], “scored”, student[“marks”])
{1, 2, 3}
Sara scored 88
✏️ Practice: build a dict for yourself (name, city, 3 skills as a list inside it) and print each part.
Module 7: Functions
Functions bundle logic behind a name: define once with def, reuse forever. Parameters make them flexible, return hands the result back, and default values (like lang="en") make arguments optional. If you copy-paste code, you needed a function.
if lang == “ur”:
return f”Salaam, {name}!”
return f”Hello, {name}!”
def area(length, width):
return length * width
print(greet(“Ali”))
print(greet(“Ali”, lang=”ur”))
print(“Area:”, area(5, 3))
Salaam, Ali!
Area: 15
✏️ Practice: write bmi(weight_kg, height_m) that returns the BMI rounded to 1 decimal.
Module 8: File Handling
Programs that forget everything on exit are toys. with open(...) reads and writes files AND closes them automatically even if errors hit — which is why it’s the only pattern worth learning. Mode “w” writes (overwrites!), “a” appends, “r” reads.
with open(“notes.txt”, “w”) as f:
f.write(“Line 1: Python file handling\n”)
f.write(“Line 2: with open() auto-closes the file\n”)
with open(“notes.txt”, “r”) as f:
for line in f:
print(line.strip())
Line 2: with open() auto-closes the file
✏️ Practice: save 3 of your goals to goals.txt, then read and print them numbered.
Module 9: Error Handling — try/except
Users type nonsense and files go missing; try/except is how programs survive reality. Catch the SPECIFIC error you expect (here ZeroDivisionError), handle it gracefully, and use finally for cleanup that must always run.
try:
return a / b
except ZeroDivisionError:
return “Cannot divide by zero!”
finally:
print(f” (attempted {a} / {b})”)
print(safe_divide(10, 2))
print(safe_divide(5, 0))
5.0
(attempted 5 / 0)
Cannot divide by zero!
✏️ Practice: wrap int(input()) in try/except so letters don’t crash your program — loop until valid.
Module 10: OOP — Classes & Inheritance
Classes are blueprints that bundle data (via __init__) with behavior (methods). Cat(Animal) inherits everything from Animal and overrides what it changes — watch the same speak() call produce different results per object. That’s polymorphism, and it’s the backbone of frameworks you’ll meet later.
def __init__(self, name):
self.name = name
def speak(self):
return f”{self.name} makes a sound”
class Cat(Animal): # inheritance
def speak(self): # method overriding
return f”{self.name} says Meow”
pets = [Animal(“Rex”), Cat(“Milo”)]for p in pets:
print(p.speak())
Milo says Meow
✏️ Practice: add a Dog class that says Woof, and give Animal an age that prints in speak().
Module 11: Modules, the Standard Library & pip
Python ships with batteries: math, random, datetime and 200+ more modules, one import away. Beyond that, pip install package-name opens 500,000+ community packages — requests for web, pandas for data. Professionals assemble more than they build from scratch.
import random
from datetime import date
print(“Square root of 144:”, math.sqrt(144))
print(“Random pick:”, random.choice([“red”, “green”, “blue”]))
print(“Today is:”, date.today().strftime(“%d %B %Y”))
# Third-party packages install with pip:
# pip install requests
Random pick: blue
Today is: 15 November 2026
✏️ Practice: use random to build a dice roller that rolls two dice and prints the total.
Module 12: Intermediate Powers — Comprehensions, Lambda, Generators, Decorators
The four features that make Python read like Python: comprehensions build lists in one line, lambda writes tiny throwaway functions (perfect as sort keys), generators produce values lazily with yield (memory-friendly for huge sequences), and decorators wrap extra behavior around functions with one @line. Master these and intermediate code stops looking like magic.
squares = [n**2 for n in range(1, 6)]print(“Squares:”, squares)
# Lambda + sorted
students = [(“Ali”, 85), (“Sara”, 92), (“Bilal”, 78)]top = sorted(students, key=lambda s: s[1], reverse=True)
print(“Topper:”, top[0])
# Generator – memory-friendly sequences
def countdown(n):
while n > 0:
yield n
n -= 1
print(“Generator:”, list(countdown(5)))
# Decorator – wrap extra behavior around a function
def shout(func):
def wrapper():
return func().upper() + “!”
return wrapper
@shout
def hello():
return “hello from techprofree”
print(hello())
Generator: [5, 4, 3, 2, 1]HELLO FROM TECHPROFREE!
✏️ Practice: write a comprehension for even numbers 1–20, then sort a list of (product, price) tuples by price with lambda.

Real outputs from the modules above — every example executed before publishing.
Mini Projects — Prove the Modules
- 🎲 Number Guessing Game (modules 2–4, 9): random number, limited attempts, hints — the classic first project. Full tutorial with code →
- 🧮 Calculator with Error Handling (modules 3, 7, 9): menu loop, functions per operation, try/except so letters and ÷0 don’t crash it. Full tutorial with code →
- 📝 To-Do CLI with File Save (modules 6, 8): add/view/delete tasks stored in a text file — your first program with memory. Build it from modules 6+8 above, then explore 145 more projects by level →
Mistakes Every Beginner Makes (With the Exact Errors)
1. The missing indent
print(“hi”)
^
IndentationError: expected an indented block after ‘if’ statement on line 1
Python’s blocks are made of spaces. Everything inside an if, loop, or function must be indented (4 spaces, consistently).
2. = vs ==
if x = 5:
print(“yes”)
^^^^^
SyntaxError: invalid syntax. Maybe you meant ‘==’ or ‘:=’ instead of ‘=’?
One = assigns, two == compares — Python even suggests the fix now. You’ll still do it; everyone does.
3. input() returns a string
print(age + 5)
File “<string>”, line 2, in <module>
TypeError: can only concatenate str (not “int”) to str
Convert before math: age = int(input("Age: ")). This single line fixes the most common beginner crash in existence.
4. The mutable default argument trap
bag.append(item)
return bag
print(add_item(“pen”))
print(add_item(“book”)) # expected [“book”], but…
Default values are created ONCE — a default list is shared across all calls. The fix: default to None, create the list inside the function.
5. Off-by-one with range()
print(list(range(5)))
print(list(range(1, 6))) # when you want 1..5
range(n) starts at 0 and stops BEFORE n. Want 1 to 5? range(1, 6). This one mistake causes half of all “my loop runs the wrong number of times” questions.
Where to Practice (Free Websites)
How to Learn Python Faster (What Actually Works)
- The 20/80 rule: 20% reading, 80% typing. Every module above has a practice line for exactly this reason — the modules you type are the modules you keep.
- Break things on purpose: after each working example, change something and predict the result before running. Wrong predictions are where learning happens.
- One project per stage: finish beginner → build the guessing game. Finish intermediate → the to-do CLI. Projects convert “I watched it” into “I can do it.”
- Read errors top to bottom: the last line names the error type, the arrow shows where. The mistakes section above trains this — error messages are instructions, not insults.
- Daily beats weekend: 1 focused hour daily outperforms a 7-hour Sunday. Programming memory consolidates with sleep between sessions.
- Use AI as a tutor, not a typist: ask it to explain, quiz you, and review your code — not to write your practice tasks. (Ready for more? Build your own AI agent in Python once you finish module 12.)
Best Free Python Books (Legally Free — Official Links)
Every link below goes to the author’s or publisher’s own site, where the book is intentionally free. No mirrors, no “free download” of paid books — if a book is paid (like Python Crash Course, which is excellent), buy it from the publisher; we don’t link pirated copies.
What to Learn After Python
- Data Science path: pandas + matplotlib on real datasets → our data science projects
- AI path: from basics to models → neural network projects in Python
- Builder path: ship something people use → build a chatbot or pick from the 145-project roadmap
📥 Download the Free PDF — Python Beginner to Advanced Notes
Python Beginner to Advanced Notes — TechProFree Edition
All 12 modules · 80-topic checklist · mistakes reference · roadmap — print-friendly, 100% free, made by us (not a pirated book)
Type it. Break it. Fix it. That’s the whole secret. 🐍
Next stop: pick your first project from the 145-project roadmap.
Frequently Asked Questions
With one focused hour daily: the beginner stage takes 3–4 weeks, intermediate another 3–4, and advanced-ready concepts 4–6 more — roughly 3 months to genuine competence. Typing and breaking every example (not just reading) is what keeps you on that schedule.
Right on this page — our own TechProFree notes PDF covers all 12 modules, the 80-topic checklist and the mistakes reference, free with no catch. For full free books, the table above links seven that are legally free from their authors, including Python for Everybody and Think Python.
Python 3, without exception — Python 2 reached end-of-life in 2020 and nothing new uses it. Every example on this page is Python 3 and was executed on a current version before publishing.
Foundation first (variables → conditions → loops → data structures), then program-building skills (functions, files, error handling), then professional patterns (OOP, libraries, comprehensions/generators/decorators) — exactly the 12-module order above, with a project after each stage to lock it in.
Core Python is the entry ticket, not the whole fare. Pair it with a direction — data analysis (pandas), web (Flask/Django), or automation — plus 3–5 real projects you can explain line by line. The ‘what to learn after’ section maps those paths.
No — we don’t host or link pirated copies of paid books like Python Crash Course. Everything downloadable here is either our own original notes or an official free release linked straight from the author or publisher.


