Practice Arena

Python Coding Challenges

Write real Python in the browser. Instant feedback. From beginner to expert.

925 challenges 556 easy 323 medium 46 hard
Python Basics easy

Count word occurrences

Write a function that takes a sentence and returns a dictionary of word counts.

strings counting dictionaries
+10 pts 15m
Python Basics easy

Parse environment variables

Write parse_env_vars that parses KEY=VALUE lines into a dict, converting booleans/numbers and ignoring comments.

strings parsing dictionaries
+8 pts 15m
Python Basics easy

Filter by Age

Filter a list of person dictionaries by age and return their names.

loops conditionals dictionaries
+8 pts 12m
Python Basics easy

Rank Employees by Salary

Sort a list of employee dictionaries by salary descending, tie-break by name, and return ranked strings.

sorting dictionaries lists
+8 pts 10m
Strings & Text easy

Parse key=value pairs

Implement a parser that converts a space-separated 'key=value' string into a Python dictionary, supporting quoted values.

parsing strings dictionaries
+8 pts 10m
Lists & Arrays easy

Average Salary by Department

Given a list of employee tuples (name, department, salary), return a dictionary mapping each department to its average salary.

averages dictionaries lists
+10 pts 15m
Dicts & Sets easy

Merge dicts summing values

Write a function that merges two dictionaries by summing values for duplicated keys.

dicts merge sum
+10 pts 10m
Dicts & Sets easy

Group names by first letter

Given a list of names, return a dictionary mapping each first letter to all names starting with that letter in original order.

dictionaries strings grouping
+10 pts 10m
Dicts & Sets easy

Missing keys default zero

Write a function to sum numeric values from dictionaries, treating missing keys as zero.

dictionaries sum defaults
+10 pts 12m
Dicts & Sets easy

Keys Sorted by Value Descending

Given a dictionary mapping strings to integers, return a list of keys sorted by value descending, and when values tie, alphabetically ascending.

sorting dictionaries ordering
+8 pts 10m
Dicts & Sets easy

Common Keys of Two Dictionaries

Implement a function that finds keys shared by two dictionaries and returns them sorted.

dict set sorting
+8 pts 10m
Dicts & Sets easy

Mode of a list via counting

Implement a function that returns the mode of a list, resolving ties by the element that appears first.

counting dictionaries mode
+10 pts 15m
Dicts & Sets easy

Sort by frequency

Sort a list by element frequency descending, with ties broken by order of first occurrence.

sorting frequency dictionaries
+10 pts 15m
Dicts & Sets medium

Hash map merge

Write a function that merges two dictionaries recursively, combining values and preserving structure.

dictionaries recursion merging
+15 pts 15m
Dicts & Sets easy

Group by Department

Implement a function that groups a list of employee dictionaries by department, returning a dictionary keyed by department with lists of employee dictionaries.

dicts loops grouping
+8 pts 10m
Data Structures & Algorithms medium

Top N per group

Implement top_n_per_group that returns the top N scores for each group from a list of (group, score) pairs.

sorting grouping dictionaries
+25 pts 25m
Data Formats & Parsing medium

Flatten nested JSON

Write a function that flattens nested JSON objects into a flat dictionary with dot-separated keys, handling lists and empty objects.

json recursion dictionaries
+20 pts 25m
Data Formats & Parsing easy

Parse table rows

Implement a function that converts a simple text table into a list of dictionaries.

parsing strings csv
+10 pts 15m
SQL & SQLite easy

Inner Join Two Tables

Write a function that inner joins two lists of dictionaries on a common key and returns the combined rows.

sql join dictionaries
+8 pts 12m

Showing 1–19 of 19 challenges

Guide: free Python coding challenges

Practice Python by solving problems

PythonSkillset challenges are hands-on coding exercises from beginner to advanced. Open a challenge, read the problem, write Python in the split-pane editor, and run tests with Pyodide — no install required.

How to use the arena

  1. Pick a category — basics, algorithms, strings, and more
  2. Open a challenge, read the statement, and edit the starter code
  3. Run tests, fix failures, then try a related quiz or tutorial lesson

Challenges vs tutorials and quizzes

Challenges test what you can build under constraints. For guided teaching, use our Python tutorials. For quick checks, try quizzes or copy snippets from code samples.