Practice Arena

Python Coding Challenges

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

467 challenges 330 easy 120 medium 17 hard
Python Basics easy

Grade from Score

Write a function that maps a numeric score to its letter grade using standard grading thresholds.

conditionals functions integers
+8 pts 10m
Python Basics easy

Map, Filter, Reduce

Implement three functions using map, filter, and reduce to manipulate a list of integers.

map filter reduce
+10 pts 15m
Strings & Text easy

Isomorphic Strings Check

Given two strings, check if they are isomorphic by verifying a one-to-one character mapping.

strings mapping hash-map
+10 pts 15m
Strings & Text medium

Substring Anagrams

Return all start indices in a string where a substring of length k is an anagram of a pattern string.

strings sliding-window hash-map
+20 pts 25m
Dicts & Sets easy

Word frequency

Return a dict mapping each word to its count in the sentence.

dict counter
+10 pts 10m
Dicts & Sets easy

Word to Index Map

Create a function that returns a dictionary mapping each unique word to the index of its first occurrence.

dictionary mapping indexing
+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

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

Top k keys by count

Given a dictionary mapping keys to counts, return the top k keys with the highest counts, breaking ties alphabetically.

dictionary sorting frequency
+10 pts 15m
Dicts & Sets easy

Replace keys with a mapping

Write a function that renames keys in a dictionary according to a mapping, with duplicate handling.

dicts mapping transformation
+8 pts 10m
Dicts & Sets easy

Two Sum with Dict

Implement the classic Two Sum problem: return indices of two numbers that add up to a target using a dict.

dictionary pair-sum hash-map
+10 pts 15m
Dicts & Sets easy

Pair with difference K

Count unordered index pairs with absolute difference exactly K, handling duplicates correctly.

dictionary set counting
+10 pts 15m
Dicts & Sets easy

Count Pairs with Sum

Implement a function that counts the number of distinct pairs in a list summing to a target.

dictionary pair-counting hash-map
+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
OOP & Classes medium

Class Method Factory

Create a class method factory that dynamically adds methods to a class based on a mapping of names to behaviors.

oop metaprogramming factory
+20 pts 25m
Data Structures & Algorithms easy

Count pairs with given difference

Count how many unordered pairs in a list have a given absolute difference using an efficient approach.

hash map counting arrays
+12 pts 15m
Data Structures & Algorithms medium

Decode Ways

Count the number of ways to decode a numeric string into letters using the mapping A=1 to Z=26.

dynamic programming strings counting
+20 pts 25m
Iterators & Generators easy

Generator Pipeline

Implement a generator function that yields only even numbers from an input list, squared.

generators lazy-evaluation filter
+8 pts 12m
Dynamic Programming medium

Longest Arithmetic Subsequence

Given a list of integers, return the length of the longest arithmetic subsequence (constant difference) within it.

dp subsequence hashmap
+30 pts 25m
Two Pointers & Sliding Window hard

Trapping Rain Water

Given an array of non-negative integers representing an elevation map, compute how much water it can trap after raining.

array two-pointers water-trapping
+40 pts 30m
Two Pointers & Sliding Window easy

Longest Substring Without Repeating Characters

Implement a function that returns the length of the longest substring without repeating characters.

strings sliding-window two-pointers
+10 pts 15m
Two Pointers & Sliding Window hard

Minimum Window Substring

Implement a sliding window algorithm to find the minimum window substring containing all characters of a given pattern.

sliding-window two-pointers strings
+45 pts 35m
Two Pointers & Sliding Window medium

Character Replacement Window

Given a string and a number k, find the length of the longest substring that can be made uniform by replacing at most k characters.

sliding-window two-pointers strings
+30 pts 25m
Two Pointers & Sliding Window medium

Permutation in String

Determine if any permutation of a shorter string appears as a contiguous substring in a longer string using an efficient sliding window.

sliding-window two-pointers hash-map
+25 pts 25m
Two Pointers & Sliding Window hard

Subarrays with K different ints

Count the number of contiguous subarrays that contain exactly K distinct integers.

sliding-window two-pointers hashmap
+40 pts 40m
Heaps & Priority Queues medium

Top K Frequent Elements

Given an integer array and a number k, return the k most frequent elements using a heap-based approach.

heap frequency counting
+25 pts 25m

Showing 26 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.