Take n Items
Given a list and a non-negative integer n, return a new list containing the first n elements.
Repeat each character n times
Given a string s and an integer n, return a new string where each character of s is repeated n times consecutively.
Extract Digits Only
Given a string that may contain letters, symbols, and whitespace, extract all digits in order and return them as an integer.
Roman to Integer
Convert a valid Roman numeral string to an integer using standard rules.
Strip Leading Zeros
Write a function that strips leading zeros from a string representing a non-negative integer.
Find all numbers in text
Write a function that extracts all standalone integers from a text string using regular expressions.
Hex encode decode
Write hex_encode and hex_decode to convert between hex strings and integer byte values.
Parse Hex Dump
Write a function that parses a hex dump string into a list of integers.
Running Product of Integers
Given a list of integers, return a new list where each element at index i is the product of all elements from index 0 to i.
Second Largest Unique Value
Return the second largest distinct integer from a list, or None if it doesn't exist.
Find Missing Number 1 to n
Given a list containing n-1 distinct integers from 1 to n, find the missing number without using extra space.
Wave sort array
Given a list of integers, reorder it into a wave pattern where elements alternate down-up, and return the new list.
Counting Sort
Implement the counting sort algorithm to sort a list of non-negative integers in O(n + k) time.
Sort array by parity
Given a list of integers, return a new list with all evens first and odds last, preserving original relative order.
Count Adjacent Pairs
Given a list of integers and a target, count adjacent pairs whose sum equals the target.
Sort List Merge Sort
Write a function that sorts a list of integers using the merge sort algorithm.
Convert Binary Number List
Given a list of bits (0s and 1s) in most-significant-first order, return the equivalent integer value.
Flatten Multidimensional Lists
Write a function that flattens arbitrarily nested lists of integers into a single list.
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.
Longest Harmonious Subsequence
Given a list of integers, find the length of the longest harmonious subsequence where the difference between maximum and minimum values is exactly 1.
Index of peak element
Implement a function that returns the index of any peak element in a given integer array.
Pascal Triangle Row
Given a non-negative integer n, return the nth row of Pascal's triangle as a list of integers.
Find Peak Index
Given a list of integers, return the index of any peak element where the value is not smaller than its neighbors.
Peak Element in Array
Implement a function that returns the index of any peak element in a list of integers.
Showing 25–48 of 98 challenges · easy
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
- Pick a category — basics, algorithms, strings, and more
- Open a challenge, read the statement, and edit the starter code
- 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.