Absolute Difference of Two Integers
Compute the absolute difference between two integers, regardless of order.
Swap Two Values
Implement a Python function that swaps two given values and returns them in swapped order.
Reverse a string
Return the characters of the string in reverse order.
Extract Digits Only
Given a string that may contain letters, symbols, and whitespace, extract all digits in order and return them as an integer.
Reverse Words in a Sentence
Reverse the order of words in a sentence while preserving single spaces between words.
Extract digits from string
Write a function that extracts all digit characters from a given string, preserving their original order.
Extract Hashtags
Extract unique hashtags from a given text string in the order they appear.
Move Zeros to the End
Reorder a list in-place, pushing all zeros to the end while preserving the order of non-zero numbers.
Interleave Two Lists
Write a function that interleaves two lists element by element, preserving order.
All Unique Values Keep Order
Remove duplicates from a list, keeping only the first occurrence of each value while preserving relative order.
Move Zeros to End
Rearrange a list by moving all zeros to the end while preserving the relative order of non-zero elements.
Difference of Two Lists
Write a function that returns items in list a that are not in list b, preserving order and duplicates.
Wave sort array
Given a list of integers, reorder it into a wave pattern where elements alternate down-up, and return the new list.
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.
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.
Values that appear once
Return a list of numbers that appear exactly once in the input list, in original order.
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.
Frequency sort descending
Write a function that sorts a list by frequency descending while preserving original order for ties.
Valid parentheses
Return True if brackets in the string close in the correct order.
Count pairs with given difference
Count how many unordered pairs in a list have a given absolute difference using an efficient approach.
Bubble Sort
Implement bubble sort that sorts a list of numbers in ascending order.
Selection Sort Implementation
Implement selection sort to sort a list of numbers in ascending order.
Tree inorder generator
Write a generator function that yields a binary tree's node values in inorder traversal.
Partition function
Write a function that returns the number of ways to write a positive integer as a sum of positive integers (order irrelevant).
Binary Tree Inorder Traversal
Implement an inorder traversal function that returns node values in left-root-right order.
Preorder Traversal
Implement a function that returns the preorder traversal values of a binary tree.
Postorder Traversal
Implement a function that returns the postorder traversal of a binary tree as a list of node values.
Showing 29 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.