Python for Beginners: Learn to Code with Real Projects

Free Python course for beginners. 15 lessons with tested code: variables, loops, functions, files, errors, classes, CSV reports, automation and a final project.

Beginner · 15 lessons

Python Basics

  1. What Is Python? Install It and Write Your First Program - Learn what Python is used for, install it on Windows, macOS or Linux, run code in the terminal and in a file, and write your first program.
  2. Variables, Numbers, Text and input() in Python - Learn how to store values in variables, do maths, work with text, use f-strings for neat output, convert between text and numbers, and ask the user for input.
  3. Making Decisions in Python: if, elif, else and Booleans - Make your programs choose between options with if, elif and else. Learn comparisons, and, or, not, truthy and falsy values, and how indentation groups code.
  4. Lists and Loops in Python: for, while and range - Store many values in a list, repeat work with for and while loops, use range and enumerate, filter with list comprehensions and slice parts of a list.
  5. Dictionaries, Tuples and Sets in Python - Use dictionaries to store data by name, count things, build tables from lists of dictionaries, and learn when to use tuples and sets for fixed or unique values.

Functions, Text and Files

  1. Functions in Python: def, Arguments and return - Write your own functions with def: parameters, default values, keyword arguments, return values, scope and the mutable default argument trap.
  2. Working with Text in Python: Cleaning, Splitting and Formatting - Clean and change text with Python string methods: strip, split, join, replace, slicing and f-string alignment, with phone number and email examples.
  3. Read and Write Files in Python: Text, CSV and JSON - Read and write text files, CSV spreadsheets and JSON data with Python. Learn with open, pathlib, csv.DictReader, json and why UTF-8 matters.
  4. Handling Errors in Python: try, except, finally and raise - Stop programs from crashing on bad input: learn exceptions, try and except, finally, raise, custom exception classes and how to read tracebacks.
  5. Modules, pip and Virtual Environments in Python - Split your code into modules, use the standard library, install packages with pip, create a virtual environment and keep a requirements.txt for your project.

Objects, Libraries and Projects

  1. Classes and Objects in Python: A Gentle Introduction - Learn what classes and objects are, write a class with __init__ and methods, use dataclasses for simple records, and see inheritance with a wallet example.
  2. The Python Standard Library: Dates, Counter, Statistics and More - Meet the standard library tools you will use all the time: datetime, timedelta, Counter, defaultdict, statistics, random, zip, sorted with key, any and all.
  3. Mini Project: Analyse a CSV File and Make a Report - Build a small data project: read an expenses CSV file, group amounts by category, sort, work out shares and print a neat report you can reuse at work.
  4. Automate Boring Tasks: Organise Files and Folders with Python - Use pathlib and shutil to sort a messy folder by file type, rename and move files safely, test on practice data first and avoid deleting anything by mistake.
  5. Final Project: A Command Line Expense Tracker, Tests and Next Steps - Build a complete command line expense tracker with argparse, JSON storage, error handling and unit tests, then plan your next steps in Python.