Compress Consecutive Chars
Write a function that compresses a string by replacing runs of identical characters with the character followed by the count.
Index of First Occurrence
Implement a function that finds the starting index of a substring within a string, returning -1 when absent.
Parse Log Line
Write a function that parses a log line and returns a dictionary with timestamp, level, and message.
Replace multiple spaces
Implement a function that replaces every sequence of spaces with a single space.
Extract domain from URL
Extract the domain (hostname without port or www) from a given URL string.
Parse URL components
Write parse_url that splits a URL into its standard components with defaults for missing parts.
Decode base64 string
Write a function that decodes a base64 string to its original UTF-8 text without using the base64 module.
User Friendly Message
Given a raw user input, format it into a single clean sentence with proper sentence case and trimming.
Two Sum
Return indices (i, j) with i < j such that nums[i] + nums[j] == target.
Remove duplicates (sorted)
Return a sorted list with duplicates removed.
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.
Pad Array Edges
Write a function that pads a list with zeros on both ends.
Sort array by parity
Given a list of integers, return a new list with all evens first and odds last, preserving original relative order.
Linear Interpolation Array
Given an array with some None values, replace them by linear interpolation between the nearest known values.
Pad array edges
Implement a function that pads a list on both ends with a given value to a specified total length.
Are two lists the same multiset
Write a function that checks if two lists contain the same elements with the same multiplicities, ignoring order.
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.
Nested get with dotted path
Implement a function that safely retrieves a value from a deeply nested dictionary using a dot-separated path, returning a default if any key is missing.
Top k keys by count
Given a dictionary mapping keys to counts, return the top k keys with the highest counts, breaking ties alphabetically.
Replace keys with a mapping
Write a function that renames keys in a dictionary according to a mapping, with duplicate handling.
Two Sum with Dict
Implement the classic Two Sum problem: return indices of two numbers that add up to a target using a dict.
Sort by frequency
Sort a list by element frequency descending, with ties broken by order of first occurrence.
Pair with difference K
Count unordered index pairs with absolute difference exactly K, handling duplicates correctly.
Count Pairs with Sum
Implement a function that counts the number of distinct pairs in a list summing to a target.
Showing 25–48 of 110 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.