Python from Scratch
A free, 100% hands-on course: learn to program in Python with 20 labs. Every command explained, with real results and a final project.
Beginner · 20 hours · 20 lessons · Free course · Course language: Spanish and English
Learn Python from your first line of code to a complete application. In 20 guided labs you write and run real programs: variables, decisions, loops, lists, dictionaries, functions, modules, CSV and JSON files, error handling and classes. Each lab explains the important commands, shows the real result of every program and the most common errors with their fix. You finish by building an expense tracker with automated tests, ready for your portfolio. It works in Google Colab, with nothing to install. The lessons, quizzes and videos are in English; the example programs keep their original Spanish names and messages, and every lesson explains them.
What you will learn
- Write and run Python programs in Google Colab or on your computer
- Use variables, operators, decisions and loops to solve problems
- Organize data with lists, tuples, sets and dictionaries
- Write reusable functions and use standard library modules
- Read and write text, CSV and JSON files
- Handle errors without your program stopping
- Create classes and build a complete application with automated tests
Skills
Python, Programming logic, Lists and dictionaries, Functions and modules, CSV and JSON files, Error handling, Object-oriented programming, Testing with assert
Program
Module 1: First steps
Your environment, variables, data types, operators, input and output.
Project: A tip calculator that asks for data and shows formatted results.
- Install Python and write your first program: Colab or your computer, the interactive interpreter, print() and how to read an error.
- Variables and data types: int, float, str and bool, type() and converting between types.
- Operators and expressions: Arithmetic, comparison, logical and assignment operators, and the order of operations.
- Input and output: input() and f-strings: Ask the user for data and show results with decimals, thousands, percentages and tables.
Module 2: Control flow
Decisions with if and match, while and for loops, break, continue and loop patterns.
Project: A guess-the-number game and the calculation of prime numbers.
- Decisions: if, elif, else and match: Simple and compound conditions, the in operator, the one-line expression and match.
- while loops: Repeat while a condition holds: counters, validation and menus.
- for loops, range, enumerate and zip: Go through lists, texts and ranges of numbers.
- break, continue and loop patterns: Searching, skipping, accumulating, counting, maximums, nested loops and for-else.
Module 3: Data structures
Lists, tuples, sets, dictionaries and text strings.
Project: An inventory with stock alerts and cleanup of form data.
- Lists: Indexes, slices, methods, sorting, comprehensions and copies.
- Tuples and sets: Data that doesn't change, unpacking, unique values and set operations.
- Dictionaries: Key-value pairs, looping over them, counting frequencies and lists of dictionaries.
- Text strings in depth: Slices, text methods, split and join, and data cleaning.
Module 4: Functions and modules
Functions, parameters, scope, lambda, the standard library, pip and virtual environments.
Project: Validation functions and your own utilities module.
- Functions: def, parameters and return: Write reusable functions, return values and document them.
- Advanced parameters, scope and lambda: Default values, *args, **kwargs, local and global variables, and lambda.
- Modules, the standard library, pip and virtual environments: math, random, datetime, your own module, pip and venv.
Module 5: Files and errors
Text and CSV files, exceptions, JSON and pathlib.
Project: A sales report generated from a CSV and a contact book saved in JSON.
- Text and CSV files: Read, write and append to files, and process CSV tables.
- Errors and exceptions: try, except, else, finally and raise for programs that don't stop.
- JSON and pathlib: Save structured data in JSON and handle files and folders.
Module 6: Classes and final project
Object-oriented programming and a complete application with tests.
Project: An expense tracker with a menu, validation, a JSON file and automated tests.
- Classes and objects: Attributes, methods, __str__, inheritance and dataclasses.
- Final project: an expense tracker: A complete application with a menu, validation, JSON and automated tests.
Prerequisites
- A computer with a browser and a Google account (for Colab)
- You don't need to know how to program: we start from scratch
Next courses
- AI in the Cloud, Skills and Your First Agent · Beginner · 6 hours · Free course
A free, 100 % hands-on course: use Claude in the cloud, create your first Skill and build your first AI agent in 6 labs. Nothing to install. - GitHub from Zero to Professional · Beginner · 25 hours · Free course
Master Git and GitHub with 25 hands-on labs: branches, pull requests, code review, GitHub Actions, cloud deployments and security. A 100% free course.