31 min readfrom Dataquest

400+ Python Practice Exercises by Topic (2026)

400+ Python Practice Exercises by Topic (2026)

The fastest way to get better at Python is to write Python. This page has 136 free practice exercises (and 298 premium) across 33 exercise sets you can solve in your browser, organized by topic and difficulty. You'll also find a short guide on how to practice effectively, the best external platforms for coding challenges, and starter projects for when you're ready to build something real. Pick your level and start writing code.

Start Learning Python

Table of Contents


Python Practice Exercises by Topic

Dataquest's exercise library has 136 free practice problems plus 298 premium exercises across 33 sets. Each exercise gives you a problem, a code editor, and instant feedback when you run your solution. No setup required.

Filter by topic to find what you need. Free exercises are listed first in every section.

Python practice exercises

33 exercise sets · 435 problems · 136 free

All
Beginner Python
Functions & OOP
NumPy
pandas
Data Analysis
Algorithms

Programming in PythonFree
Programming · Printing · Beginner
Print statements, basic operators, calculations
11
exercises
Variables and Data TypesFree
Programming · Variables · Beginner
Variable assignment, arithmetic, type conversion
10
exercises
Lists and For LoopsFree
Programming · Lists · Beginner
Creating lists, indexing, iterating with for loops
20
exercises
ListsFree
Lists · Basic Data Types · Beginner
Append, slicing, nested lists, list methods
20
exercises
DictionariesFree
Dictionaries · Basic Data Types · Beginner
Key-value pairs, accessing and updating values
7
exercises
Dictionaries and Frequency TablesFree
Programming · Dictionaries · Beginner
Counting occurrences, building frequency tables
11
exercises
NumPy Index SelectionFree
NumPy · Beginner
Array indexing, slicing, selecting values
17
exercises
Pandas SeriesFree
Pandas · Series · Beginner
Creating Series, indexing, vectorized operations
23
exercises
Cleaning and Preparing DataFree
Programming · Data cleaning · Beginner
Removing bad characters, filling missing values, validation
6
exercises
Time Complexity of AlgorithmsFree
Algorithms · Linear time complexity · Beginner
Identifying Big O notation, comparing algorithm speed
11
exercises
Conditional Statements
Programming · Conditionals · Beginner
If-else logic, comparison operators, boolean expressions
20
exercises
Sets
Sets · Basic Data Types · Beginner
Set creation, union, intersection, difference
10
exercises
Functions: Fundamentals
Programming · Functions · Beginner
Defining functions, parameters, return values
12
exercises
Functions: Intermediate
Programming · Functions · Beginner
Multiple return values, default arguments, scope
6
exercises
Object-Oriented Python
Object oriented programming · Classes · Beginner
Classes, methods, attributes, inheritance basics
6
exercises
Creating Ndarrays
NumPy · Beginner
np.array, np.zeros, np.arange, reshaping
14
exercises
Ndarray Methods
NumPy · Beginner
sum, mean, max, min, axis operations
15
exercises
Broadcasting
NumPy · Beginner
Operations across different array shapes
11
exercises
NumPy Boolean Masks
NumPy · Beginner
Conditional filtering, where, logical operators
20
exercises
NumPy Datatypes
NumPy · Beginner
dtype conversion, int vs float, string arrays
21
exercises
Sorting Ndarrays
NumPy · Beginner
np.sort, argsort, sorting along axes
12
exercises
Stacking and Splitting
NumPy · Beginner
vstack, hstack, concatenate, split
15
exercises
Creating and Manipulating DataFrames
Pandas · Beginner
DataFrame construction, adding/removing columns
10
exercises
Selecting Data in DataFrames
Pandas · Beginner
loc, iloc, column selection, row filtering
22
exercises
Loading and Exploring Data
Pandas · Beginner
read_csv, head, describe, info, shape
20
exercises
Pandas Boolean Masks
Pandas · Beginner
Conditional filtering, combining conditions
22
exercises
Pandas Data Cleaning
Pandas · Beginner
Handling nulls, replacing values, type conversion
10
exercises
Python Data Analysis Basics
Programming · Data Analysis · Beginner
CSV processing, using dictionaries and functions together
6
exercises
Working with Dates and Times
Date and times · Beginner
datetime module, parsing dates, time calculations
13
exercises
Constant Time Complexity
Algorithms · Constant time complexity · Beginner
O(1) operations, hash table lookups
13
exercises
Logarithmic Complexity
Algorithms · Logarithmic time complexity · Beginner
Binary search, O(log n) patterns, divide and conquer
8
exercises
Sorting Algorithms
Algorithms · Sorting · Beginner
Bubble sort, merge sort, comparing sort approaches
7
exercises
Space Complexity
Algorithms · Space complexity · Beginner
Memory usage analysis, in-place vs copy operations
6
exercises

Beginner Python
Programming in PythonFree
Programming · Printing · Beginner
Print statements, basic operators, calculations
11
exercises
Variables and Data TypesFree
Programming · Variables · Beginner
Variable assignment, arithmetic, type conversion
10
exercises
Lists and For LoopsFree
Programming · Lists · Beginner
Creating lists, indexing, iterating with for loops
20
exercises
ListsFree
Lists · Basic Data Types · Beginner
Append, slicing, nested lists, list methods
20
exercises
DictionariesFree
Dictionaries · Basic Data Types · Beginner
Key-value pairs, accessing and updating values
7
exercises
Dictionaries and Frequency TablesFree
Programming · Dictionaries · Beginner
Counting occurrences, building frequency tables
11
exercises
Conditional Statements
Programming · Conditionals · Beginner
If-else logic, comparison operators, boolean expressions
20
exercises
Sets
Sets · Basic Data Types · Beginner
Set creation, union, intersection, difference
10
exercises
New to Python? Start with Programming in Python. Already know variables and loops? Jump to Dictionaries.Start with Programming in Python →

Functions & OOP
Functions: Fundamentals
Programming · Functions · Beginner
Defining functions, parameters, return values
12
exercises
Functions: Intermediate
Programming · Functions · Beginner
Multiple return values, default arguments, scope
6
exercises
Object-Oriented Python
Object oriented programming · Classes · Beginner
Classes, methods, attributes, inheritance basics
6
exercises
Start with Functions: Fundamentals. Once you can write functions, most Python work becomes about breaking problems into smaller pieces.Start with Functions →

NumPy
NumPy Index SelectionFree
NumPy · Beginner
Array indexing, slicing, selecting values
17
exercises
Creating Ndarrays
NumPy · Beginner
np.array, np.zeros, np.arange, reshaping
14
exercises
Ndarray Methods
NumPy · Beginner
sum, mean, max, min, axis operations
15
exercises
Broadcasting
NumPy · Beginner
Operations across different array shapes
11
exercises
NumPy Boolean Masks
NumPy · Beginner
Conditional filtering, where, logical operators
20
exercises
NumPy Datatypes
NumPy · Beginner
dtype conversion, int vs float, string arrays
21
exercises
Sorting Ndarrays
NumPy · Beginner
np.sort, argsort, sorting along axes
12
exercises
Stacking and Splitting
NumPy · Beginner
vstack, hstack, concatenate, split
15
exercises
NumPy Index Selection is free with 17 exercises. Array indexing extends list indexing in ways that trip up a lot of people - start here.Start with Index Selection →

pandas
Pandas SeriesFree
Pandas · Series · Beginner
Creating Series, indexing, vectorized operations
23
exercises
Creating and Manipulating DataFrames
Pandas · Beginner
DataFrame construction, adding/removing columns
10
exercises
Selecting Data in DataFrames
Pandas · Beginner
loc, iloc, column selection, row filtering
22
exercises
Loading and Exploring Data
Pandas · Beginner
read_csv, head, describe, info, shape
20
exercises
Pandas Boolean Masks
Pandas · Beginner
Conditional filtering, combining conditions
22
exercises
Pandas Data Cleaning
Pandas · Beginner
Handling nulls, replacing values, type conversion
10
exercises
Pandas Series is free with 23 exercises. Series are the building block of every DataFrame - understanding them makes everything in pandas click faster.Start with Pandas Series →

Data Analysis
Cleaning and Preparing DataFree
Programming · Data cleaning · Beginner
Removing bad characters, filling missing values, validation
6
exercises
Python Data Analysis Basics
Programming · Data Analysis · Beginner
CSV processing, using dictionaries and functions together
6
exercises
Working with Dates and Times
Date and times · Beginner
datetime module, parsing dates, time calculations
13
exercises
Cleaning and Preparing Data is free with 6 exercises. Data cleaning is the most practical skill here - real-world datasets are always messy.Start with Data Cleaning →

Algorithms
Time Complexity of AlgorithmsFree
Algorithms · Linear time complexity · Beginner
Identifying Big O notation, comparing algorithm speed
11
exercises
Constant Time Complexity
Algorithms · Constant time complexity · Beginner
O(1) operations, hash table lookups
13
exercises
Logarithmic Complexity
Algorithms · Logarithmic time complexity · Beginner
Binary search, O(log n) patterns, divide and conquer
8
exercises
Sorting Algorithms
Algorithms · Sorting · Beginner
Bubble sort, merge sort, comparing sort approaches
7
exercises
Space Complexity
Algorithms · Space complexity · Beginner
Memory usage analysis, in-place vs copy operations
6
exercises
Time Complexity is free with 11 exercises. Understanding Big O changes how you think about code - it's the foundation for everything else here.Start with Time Complexity →

How to Practice Python Effectively

Not all practice is equal. Copying code from a tutorial teaches you very little. Effective practice sits in the sweet spot between too easy and too hard, and it follows a progression.

The 3 Types of Python Practice

Three Types of Practice

Targeted exercises drill one concept at a time — loops, functions, list comprehensions — until the syntax becomes automatic. This is where beginners should start. Dataquest's practice page is built for this kind of focused repetition.

Coding challenges test your ability to combine concepts and solve problems under constraints. Platforms like LeetCode and HackerRank are built for this. These are especially valuable for interview prep.

Projects tie everything together. You pick a problem, design a solution, and build something that works. Projects teach skills that isolated exercises can't: reading documentation, structuring code, and handling messy data. Our Python projects guide has 60+ ideas by skill level.

Python Practice Projects

At some point, exercises aren't enough. You need to build something real. Projects teach you skills that isolated exercises can't: reading documentation, handling unexpected data, structuring code for maintainability, and actually finishing something.

The transition point is usually around week 6-8 of consistent practice. If you can write functions, work with lists and dictionaries, and handle basic file I/O, you're ready for a beginner project.

Here are four good starter projects, all available as free guided walkthroughs:

  1. Interactive Word Game — Build a word-guessing game using loops, conditionals, and string operations. Great first project because it's fun and the logic is straightforward.
  2. App Market Analysis — Analyze real data from the App Store and Google Play to find which types of apps attract the most users. Your first real data analysis project.
  3. Predicting Heart Disease — Build a simple prediction model using health data from the World Health Organization. A meaningful introduction to machine learning.
  4. Dynamic AI Chatbot — Create a chatbot that tracks conversation history and switches personas. A great bridge into AI and API work.

For the full list of 60+ project ideas organized by skill level, see our Python projects for beginners guide.

Python Courses That Include Practice

If you prefer structured learning where exercises are built into the lessons, these courses combine instruction with hands-on coding. You read a short lesson, solve a problem in your browser, and move on. Each course includes at least one free lesson.

Python Fundamentals: Python Syntax & Variables | For Loops & Dictionaries | Functions & Jupyter Notebook

Data Analysis & Visualization: Pandas & NumPy Fundamentals | Data Visualization Fundamentals | Storytelling with Data Visualization

Data Cleaning: Data Cleaning & Analysis | Advanced Data Cleaning | Data Cleaning Guided Project

Machine Learning: Intro to Supervised Learning | Linear Regression | Decision Trees & Random Forests

AI & Deep Learning: APIs for AILLM Chatbots |Deep Learning with TensorFlow

Probability & Statistics: Intro to Statistics | Probability Basics | Hypothesis Testing

For the complete list, visit Dataquest's Python course catalog.

A Simple Practice Plan That Works

You don't need to practice for hours. Consistency matters more than marathon sessions. Here's a realistic plan:

Simple Python Practice Plan

Weeks 1-4 (Building foundations): Spend 20-30 minutes per day on targeted exercises. Focus on one topic per week: variables and data types in week one, loops and conditionals in week two, functions in week three, data structures (lists, dictionaries, sets) in week four. Complete 3-5 exercises per session.

Weeks 4-8 (Combining concepts): Mix targeted exercises with coding challenges. Spend half your practice time on new topics (string manipulation, file I/O, error handling) and half on challenge problems that require combining skills you've already practiced.

Weeks 8+ (Building things): Start a small project while continuing 2-3 challenge problems per week. The project gives you context for why the fundamentals matter. The challenges keep your problem-solving sharp.

A note about AI tools: GitHub Copilot, ChatGPT, and Claude can be genuinely useful alongside practice, not as a replacement for it. Use AI to explain concepts you're stuck on, review code you've already written, or generate new practice problems. Don't use it to write solutions for you. If you skip the struggle of solving problems yourself, you skip the learning.

FAQs

Where can I practice Python programming online?

Dataquest has 130+ free interactive exercises with in-browser coding, organized by topic. HackerRank covers Python across all difficulty levels. LeetCode is the standard for interview prep. Exercism offers free exercises with optional mentor feedback. W3Schools has simple fill-in-the-blank exercises for absolute beginners.

How should I practice Python for job interviews?

Make sure your fundamentals are solid first — especially functions, lists, dictionaries, and string manipulation. Then move to LeetCode for algorithm-style problems. Start with "Easy" and aim to solve them in under 15 minutes before moving to "Medium." For data roles, prioritize pandas alongside Python. Practice explaining your thought process out loud while you code.

How many Python exercises should I do per day?

Three to five focused exercises is more effective than twenty rushed ones. If an exercise takes more than 20 minutes, review the underlying concept before continuing. Consistency matters most — 30 minutes daily beats a 10-hour weekend sprint followed by a week off.

Can I practice Python on mobile?

Apps like Mimo work for reviewing concepts on the go. But mobile practice shouldn't be your primary method for building professional skills. Real development happens with a proper code editor and terminal access. Dataquest lets you write code in your browser without installing anything, which works well on tablets.

Should I still practice Python now that AI can write code?

Yes. AI tools generate code, but they can't replace the understanding that comes from writing it yourself. AI-generated code often contains subtle bugs or inefficient patterns. If you can't read, evaluate, and debug code, you can't use AI effectively.

Think of it this way: AI is a powerful calculator, but you still need to understand math to know when it gives a wrong answer. The most effective approach is to write your solution first, then use AI to review or improve it.

Python itself remains central to the AI field — TensorFlow, PyTorch, and most ML workflows run on Python. Understanding the language makes you a better user of AI tools, not a redundant one.

Want to read more?

Check out the full article on the original site

View original article

Tagged with

#row zero
#generative AI for data analysis
#Excel alternatives for data analysis
#real-time data collaboration
#data analysis tools
#conversational data analysis
#data cleaning solutions
#data visualization tools
#intelligent data visualization
#big data management in spreadsheets
#big data performance
#enterprise data management
#natural language processing for spreadsheets
#financial modeling with spreadsheets
#real-time collaboration
#machine learning in spreadsheet applications
#no-code spreadsheet solutions
#natural language processing
#enterprise-level spreadsheet solutions
#large dataset processing