Python Playground

Python for Data Science, one topic at a time

Start with variables and work up to pandas and analytics. Write code in your browser, run it, and get every answer checked against visible and hidden tests.

16sections
65questions live
3levels each

No account? Try 5 easy, 2 medium and 1 hard question first. Create a free account to unlock everything and save progress.

Foundations

Core Python, the way analysts actually use it.
03

Conditions and Logic

Comparisons, boolean logic, if/elif/else and business rules such as tiers, flags and validations.

20 easy soon 15 medium soon 10 hard soon
Questions coming soon
04

Loops and Iteration

for and while loops, range, accumulators, counters, running totals, break and continue.

20 easy soon 15 medium soon 10 hard soon
Questions coming soon
05

Lists and Tuples

Creating and changing lists, slicing, sorting, aggregates, tuples and unpacking.

20 easy soon 15 medium soon 10 hard soon
Questions coming soon
06

Dictionaries and Sets

Lookups, frequency counts, grouping and set operations for de-duplication and overlap.

20 easy soon 15 medium soon 10 hard soon
Questions coming soon
07

Functions

Defining functions, parameters, defaults, return values, scope, *args, **kwargs and lambdas.

20 easy soon 15 medium soon 10 hard soon
Questions coming soon
08

Comprehensions and Built-ins

List, dict and set comprehensions with zip, enumerate, sorted with key, map, filter, any and all.

20 easy soon 15 medium soon 10 hard soon
Questions coming soon
09

Errors, Files and Data Formats

try/except, validating input, raising errors, parsing CSV and JSON text.

20 easy soon 15 medium soon 10 hard soon
Questions coming soon
10

Classes and Objects

Classes for data entities: __init__, methods, __repr__, properties, dataclasses and simple inheritance.

20 easy soon 15 medium soon 10 hard soon
Questions coming soon

Data handling

Turn raw records into answers with plain Python.
11

Working with Records and Dates

Pure-Python analytics on lists of dictionaries: filter, aggregate, group, join and top-N, plus datetime.

20 easy soon 15 medium soon 10 hard soon
Questions coming soon

Data science

NumPy, pandas and the statistics behind every report.
12

NumPy Essentials

Arrays, vectorised maths, boolean masks, aggregation along axes and broadcasting.

20 easy soon 15 medium soon 10 hard soon numpy
Questions coming soon
13

pandas Basics

Series and DataFrames: creating, inspecting, selecting, filtering, sorting and new columns.

20 easy soon 15 medium soon 10 hard soon numpy + pandas
Questions coming soon
14

pandas Data Cleaning

Missing values, data types, text and date columns, duplicates, outliers and tidy transformations.

20 easy soon 15 medium soon 10 hard soon numpy + pandas
Questions coming soon
15

pandas Grouping, Merging and Reshaping

groupby and aggregation, merges and joins, pivot tables, melt, and window calculations.

20 easy soon 15 medium soon 10 hard soon numpy + pandas
Questions coming soon
16

Statistics and Analytics with Python

Descriptive statistics, percentiles, z-scores, correlation, A/B test lift, cohorts, retention and RFM.

20 easy soon 15 medium soon 10 hard soon numpy + pandas
Questions coming soon
FAQ

About the Python Playground

You can try 5 easy, 2 medium and 1 hard question without an account. A free account unlocks every question and saves your progress, attempts and code.

Python 3.13 runs directly in your browser, with NumPy and pandas available in the data science sections. Nothing is installed on your computer and your code never leaves your device to run.

Each question has test cases. Some are shown so you know exactly what is expected; others are hidden so the answer cannot be hard-coded. Decimals are compared to 6 places, and printed output ignores trailing spaces.

Write a function, write a program, compute a value, complete the code, fix the bug, predict the output and transform a dataset. Every section has easy, medium and hard questions.

The sections follow the order of the upcoming Python for Data Science and Analytics course, so each section doubles as the exercise set for its module.