Expand compressed string
Implement a function that expands run-length encoded strings (e.g., 'a3b2' → 'aaabb').
Find substring index
Implement a function that returns the starting index of the first occurrence of a substring using only basic string indexing and slicing.
Count Substrings
Implement a function that counts non-overlapping occurrences of a substring in a given string.
Sort characters in string
Write a function that sorts the characters in a string and returns the sorted string.
Index of First Occurrence
Implement a function that finds the starting index of a substring within a string, returning -1 when absent.
Error message formatter
Write a function that constructs a formatted error message from a code, an optional context, and a fallback message.
Stack Trace Sanitizer
Implement a function that rewrites traceback file paths to basenames only.
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 Quoted Strings
Write a function that extracts the text inside every double-quoted substring from a given string.
Normalize Whitespace
Write a function that normalizes any whitespace in a string to single spaces and trims the ends.
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.
Extract file extensions
Implement a function that extracts the extension from a filename according to standard rules.
Validate username format
Implement a function that validates a username according to length, allowed characters, and no consecutive underscores.
Replace template variables
Implement a function that replaces {{variable}} placeholders in a string using a dictionary, leaving unknown placeholders intact.
Hamming Distance
Implement a function that computes the Hamming distance between two strings of equal length.
Caesar Cipher Decrypt
Implement a function that decrypts a Caesar cipher by shifting letters back by a given number.
Simplify Path
Implement a function that simplifies a Unix-style absolute file path to its canonical form.
Remove Duplicate Letters
Implement a function that removes duplicate characters from a string while preserving the order of their first occurrence.
Change directory manager
Implement a function that processes `cd` commands and returns the resulting absolute path.
Parse HTTP Status Line
Write a function that parses a well-formed HTTP status line into its three components.
Parse markdown headers
Write a function that parses markdown headers and returns their levels and texts.
Decode base64 string
Write a function that decodes a base64 string to its original UTF-8 text without using the base64 module.
Showing 97–120 of 365 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
- 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.