Interactive roadmap
Python roadmap
Learn Python from your first script to confident, well-tested code.
- 1
Basics
0 of 4 done
Write your first programs.
Take it one small step at a time, and don't worry about memorising everything straight away. You've got this. - 2
Working with data
0 of 4 done
Python's built-in collections.
Keep your data structures simple at first, and always check what format your files are in before reading them. - 3
Structuring code
0 of 4 done
Write programs that stay tidy as they grow.
Organise your project files early so you don't end up with one massive script that is hard to maintain. - 4
Where to go next
0 of 3 done
Pick a direction.
Pick one area that genuinely excites you and build a small project to cement your new skills.
Learn it all, with a tutor that never sleeps
Every topic links to LevelUp lessons, practice exercises and the 24/7 AI Tutor. Your progress updates as you master lessons.
Every topic explained
Step 1: Basics
- Installing Python, running code and using an editor.The Python tutorial (official)
Read more
Python is a popular programming language known for being clear and easy to read. To get started, you install Python on your computer and use a text editor to write your instructions. When you run your file, Python reads your commands from top to bottom and carries them out.
Think of writing your first script like leaving a simple recipe for a friend. You list instructions line by line, such as asking Python to display a friendly greeting on your screen. Getting this first setup working proves your environment is ready for action.
Learning how to run code safely on your own machine is the foundation of every programming journey. It gives you a safe sandbox to experiment, make mistakes, and watch your logic come to life instantly.
- Download Python from the official website
- Use a text editor like VS Code
- Run scripts using your command line
- Print statements output text to screen
- Numbers, strings, booleans and converting between them.The Python tutorial (official)
Read more
Variables are simply named containers that hold information in your computer's memory. Python has different data types for different jobs, such as whole numbers, text strings, and true-or-false booleans. You can convert between these types when you need to combine text with numbers.
Imagine a row of labelled boxes in your hallway. One box holds your house keys as text, while another holds your monthly grocery budget as a number. Labelling them clearly stops you from trying to spend your keys.
Choosing the right data type ensures your calculations work correctly and prevents unexpected crashes when your program processes user input.
- Variables store values using the equals sign
- Strings hold text inside quotation marks
- Integers and floats represent numbers
- Booleans represent true or false
- if, for and while to make decisions and repeat work.The Python tutorial (official)
Read more
Conditional statements allow your program to make decisions based on changing inputs, using checks like if, elif, and else. Loops, such as for and while, let you repeat a block of code multiple times without rewriting it. Together, they give your scripts intelligence and flexibility.
Think of an umbrella check at your front door. If it is raining outside, your program grabs an umbrella; otherwise, it leaves it behind. Loops work like walking down a supermarket aisle and checking every single shelf item one by one.
Mastering control flow means your code can handle messy real-world scenarios, processing thousands of items automatically instead of manually.
- If statements test conditions before acting
- Else blocks handle alternative outcomes
- For loops iterate over collections
- While loops run until a condition changes
- Reusable blocks of code with parameters and return values.The Python tutorial (official)
Read more
Functions are self-contained blocks of code designed to perform a specific task. You give them inputs called parameters, they do some work, and they often give back a result using a return statement. This stops you from repeating the exact same code across your project.
Consider a coffee machine in your office kitchen. You insert coffee beans and water as inputs, the machine processes them, and it returns a hot cup of coffee ready to drink.
Writing modular functions keeps your code tidy, makes debugging much easier, and lets you reuse your logic whenever you need it.
- Define functions using the def keyword
- Pass data into functions via parameters
- Use return to send results back out
- Keep functions focused on a single task
Step 2: Working with data
- Choosing the right container for your data.Data structures (Python docs)
Read more
Python offers built-in collections to group related pieces of data together efficiently. Lists keep items in order, dictionaries store key-value pairs, sets hold unique items, and tuples are fixed collections you cannot change after creation.
Think of a contact book on your phone. The main list of names acts like a list, while each name linked directly to a phone number behaves like a dictionary.
Picking the right container speeds up your program and keeps your codebase logical and easy for other developers to understand.
- Lists use square brackets and maintain order
- Dictionaries map keys to values
- Sets automatically remove duplicate items
- Tuples are immutable and unchangeable
- Building lists and dictionaries in one readable line.
Read more
Comprehensions provide a concise, readable way to build new lists or dictionaries from existing iterables in a single line of code. They combine loops and conditional checks cleanly without needing multi-line blocks.
Imagine quickly sorting through a basket of fruit to pick out only the apples and polish them in one swift motion.
Using comprehensions makes your code look professional and idiomatic, reducing unnecessary lines while keeping your intentions clear.
- List comprehensions build lists in one line
- Dictionary comprehensions create key-value pairs
- Add conditions to filter items easily
- Keep them readable rather than overly complex
- Reading and writing files, CSV and JSON.Input and output (Python docs)
Read more
Real applications often need to read and write information outside of memory, using text files, comma-separated values, or JSON data structures. Python makes handling these external files straightforward using context managers that safely close files when finished.
Think of opening a physical filing cabinet, updating a ledger sheet with today's figures, and locking the drawer again securely.
Knowing how to parse JSON and text files allows your programs to save user settings, log events, and talk to external services.
- Use context managers with the open function
- Read and write plain text files safely
- Parse JSON data into Python dictionaries
- Handle file paths carefully across operating systems
- Handling problems gracefully with try and except.Errors and exceptions (Python docs)
Read more
Errors happen when code encounters unexpected situations, such as missing files or invalid user input. Instead of letting your program crash abruptly, you can catch these issues using try and except blocks to handle problems gracefully.
Think of a car dashboard displaying a warning light when tyre pressure drops, rather than the engine cutting out instantly on the motorway.
Proper error handling makes your applications robust and user-friendly, ensuring they recover smoothly from unexpected hiccups.
- Wrap risky code inside try blocks
- Catch specific errors with except clauses
- Use finally to run clean-up tasks
- Avoid catching every error blindly
Step 3: Structuring code
- Splitting code into files and installing packages with pip.Modules (Python docs)
Read more
As projects grow, splitting your code across multiple files keeps things manageable. A module is simply a Python file you can import into another, while packages let you group related modules together. You can also install third-party packages using pip.
Think of organising a physical workshop into different toolboxes, keeping woodworking tools separate from electronics gear so you can find what you need.
Modular design keeps your code clean and allows you to leverage powerful community-built tools without writing everything from scratch.
- Import custom modules using the import keyword
- Group modules into structured packages
- Install external tools using pip
- Keep helper functions in dedicated files
- Keeping each project's packages separate.Virtual environments (Python docs)
Read more
Virtual environments create an isolated sandbox for a specific project, storing its installed packages locally rather than globally on your computer. This stops different projects from fighting over conflicting library versions.
Think of renting a dedicated studio for a painting project where all your specific brushes and paints stay neatly contained.
Using virtual environments is an essential professional habit that keeps your development setup clean and reproducible.
- Create environments with venv module
- Activate the environment before installing packages
- Keep dependencies isolated per project
- Generate requirements files for sharing
- Modelling things with classes, methods and attributes.Classes (Python docs)
Read more
Object-oriented programming lets you model real-world concepts by bundling data and behaviour together inside classes. Classes act as blueprints, while individual objects created from them have their own attributes and methods.
Think of a blueprint for a house. The blueprint is the class, while the three actual houses built on the street are the individual objects.
Object-oriented design helps you structure large programs logically, making complex systems easier to scale and maintain.
- Define classes using the class keyword
- Initialise objects using the init method
- Store data inside object attributes
- Add actions using methods
- Small automated tests that prove your code works.pytest: get started
Read more
Automated testing means writing small scripts that check your code works correctly for you. Using testing frameworks like pytest, you can run dozens of checks in seconds whenever you make changes.
Think of quality control tests on an assembly line that automatically check every manufactured part before it leaves the factory.
Writing tests gives you the confidence to refactor and improve your code without fear of breaking existing features.
- Name test files starting with test underscore
- Write simple assertion statements
- Run tests using the pytest command
- Catch regressions before shipping code
Step 4: Where to go next
- (optional)
- pandas, notebooks and charts.Getting started with pandas
Read more
Data analysis involves taking raw numbers, cleaning them up, and discovering hidden patterns using specialised libraries like pandas. You can process spreadsheets and generate visual charts to explain your findings clearly.
Think of an accountant reviewing monthly sales figures and drawing simple graphs to show management where growth is happening.
Python is a leading language in data science, making it invaluable for anyone working with business metrics or research data.
- Pandas handles tabular data efficiently
- Jupyter notebooks help explore data interactively
- Clean messy data before analysis
- Visualise trends using charts
- (optional)
- Building web apps and APIs with Django or FastAPI.FastAPI tutorial
Read more
Web development with Python lets you build dynamic websites and robust application programming interfaces using frameworks like FastAPI or Django. These tools handle routing requests, managing databases, and returning data to users.
Think of a restaurant kitchen where customers place orders at the front counter, and the kitchen staff prepares and returns the correct dishes.
Building web apps unlocks the ability to turn your Python scripts into live services that people around the world can use.
- Frameworks handle HTTP requests and responses
- APIs let different software systems talk
- FastAPI offers speedy modern endpoints
- Django provides full-stack batteries included
- (optional)
- Scripts that save hours: renaming files, sending reports, scraping data.
Read more
Automation scripts take over repetitive digital chores, saving you hours of tedious manual work every week. You can write programs that rename folders of photos, scrape website updates, or compile daily summary emails automatically.
Think of setting up a smart sprinkler system that waters your garden every morning without you having to turn the tap.
Automation is often the most rewarding immediate use for Python, bringing instant productivity gains to your daily routine.
- Automate file renaming and organisation
- Scrape web pages for useful information
- Schedule scripts to run automatically
- Eliminate repetitive manual keystrokes