Practice Arena

Python Coding Challenges

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

819 challenges 506 easy 280 medium 33 hard
Python Basics easy

Last Occurrence of a Value

Implement a function that returns the last index of a given value in a list, or -1 if it's not present.

lists search indexing
+10 pts 15m
Python Basics easy

Print Pyramid Pattern

Implement a function that returns a centered asterisk pyramid as a list of strings.

loops strings pattern-printing
+10 pts 15m
Python Basics easy

Last Digit Extractor

Write a function that returns the last digit of a non-negative integer using the modulo operator.

integers modulo arithmetic
+5 pts 5m
Python Basics medium

Longest Substring with K Repeating Characters

Return the length of the longest substring of a given string in which every character appears at least K times.

strings sliding-window substring
+18 pts 20m
Python Basics easy

Broadcast Add Scalar

Add a scalar to every number in a 2D list and return a new 2D list without modifying the original.

nested-loops addition lists
+10 pts 15m
Strings & Text easy

Replace vowels with stars

Write a function that replaces every vowel in a given string with an asterisk.

strings transformation vowels
+10 pts 10m
Strings & Text easy

Is pangram?

Implement is_pangram(s) to return True if the string contains every letter from 'a' to 'z' at least once, ignoring case and non-alphabetic characters.

strings set validation
+8 pts 10m
Strings & Text easy

Abbreviate Name

Create a function that takes a full name and returns an abbreviated version with initials and the last name.

strings formatting split
+10 pts 15m
Strings & Text easy

Mask email address

Given an email address, return a masked version that hides everything but the first and last character of the local part and the domain.

strings masking validation
+8 pts 10m
Lists & Arrays easy

Last occurrence index

Implement a function that returns the last index of a given value in a list, or -1 if the value is not present.

lists indexing search
+10 pts 10m
Lists & Arrays easy

Sort array by parity

Given a list of integers, return a new list with all evens first and odds last, preserving original relative order.

sorting arrays two-pointers
+10 pts 15m
Data Structures & Algorithms medium

Redundant Connection

Given a list of edges forming a tree plus one extra edge, return the edge that appears last in the input and creates a cycle.

graphs union-find cycle-detection
+25 pts 25m
Data Structures & Algorithms medium

AST Visitor Lite

Implement a depth-first traversal of a simplified AST and return identifier names in order.

trees traversal ast
+20 pts 20m
Iterators & Generators easy

Digit Expansion Generator

Create a generator that lazily yields each decimal digit of a non-negative integer from most significant to least significant.

generators yield digits
+8 pts 10m
Math & Number Theory medium

Polynomial Fit Coefficients

Implement a function that returns the coefficients of the best-fit quadratic polynomial for given points.

least-squares linear-algebra polynomial
+25 pts 25m
Bit Manipulation easy

Toggle kth Bit

Implement a function that toggles the kth bit of a non-negative integer (0-indexed from the least significant bit) and returns the new integer.

bit-manipulation xor binary
+10 pts 10m
Dynamic Programming medium

Perfect Squares Sum

Given a positive integer n, return the least number of perfect squares (e.g., 1, 4, 9, 16, ...) that sum to n.

dynamic-programming math optimization
+25 pts 25m
Dynamic Programming medium

Integer Break Product

Given a positive integer n, break it into at least two positive integers that sum to n and maximize their product.

integer-break dynamic-programming max-product
+25 pts 30m
Trees & Binary Trees medium

Count Complete Tree Nodes

Given a complete binary tree, return its node count faster than O(n) time.

binary-tree complete-tree tree-traversal
+25 pts 25m
Graphs & Graph Algorithms medium

All Paths from Source to Target

Given a directed acyclic graph, return all paths from node 0 to the last node.

graph dfs backtracking
+25 pts 25m
Greedy Algorithms medium

Candy Distribution

Compute the minimum total candies needed so that every child gets at least one and children with higher ratings than neighbors get more candies.

greedy arrays optimization
+20 pts 20m
Greedy Algorithms medium

Jump Game Reachable

Given an array of non-negative integers where each element is the maximum jump length, determine if you can reach the last index.

greedy arrays jump-game
+20 pts 20m
Binary Search easy

Find Indices of Target in Sorted List

Given a sorted list and a target, return the indices of its first and last occurrence, or [-1, -1] if absent.

binary-search sorted range
+10 pts 10m
Binary Search medium

Search 2D Matrix

Given a sorted 2D matrix with sorted rows and first element of each row greater than last of previous, find target efficiently.

binary search 2d matrix searching
+20 pts 25m
Two Pointers & Sliding Window medium

Minimum Size Subarray Sum

Given an array of positive integers, return the minimal length of a contiguous subarray with sum at least target, or 0 if none exists.

sliding-window two-pointers array
+25 pts 30m
Stacks & Queues medium

Asteroid Collision

Simulate asteroid collisions with a stack and return the remaining asteroids in original order.

stack simulation arrays
+20 pts 25m
Heaps & Priority Queues easy

Last Stone Weight

Given an array of stone weights, repeatedly smash the two heaviest stones and return the last remaining weight or 0.

heap priority-queue simulation
+10 pts 15m

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