Python coding challenges

226 challenges you can solve in Python, from first loops to graphs, dynamic programming and machine learning. Write your code in the browser, run the tests instantly and get an AI review.

Easy · 134 Medium · 68 Hard · 24

Skills you'll practise: CountingDigit extractionString splitting2D listsArithmeticFormulasListsLoopsConditionsDivisibilityFloating pointGradient descent
  • Python · C++ · C#
  • Automated tests
  • AI code review
  • Community solutions
226
Challenges
2
Solutions shared
3
Languages

All challenges

Search by topic, language, or difficulty.

226 challenges
Easy

Pangram Check

A pangram contains every English letter at least once.

You'll learn Letter setsCase normalization
SetsStrings
No solutions yet
Easy

Reverse a String

Return the characters of a string in reverse order.

You'll learn Reverse iterationSlicing
BeginnerStringsStudent-beginner
No solutions yet
Easy

Cart Total With Discount

Total a shopping cart and apply a discount above a threshold.

You'll learn ListsDiscount rules
ArraysBeginnerFunctionsLearning-path
No solutions yet
Easy

Anagram Check

Check whether two phrases use the same letters.

You'll learn SortingFrequency counts
BeginnerStringsStudent-beginner
No solutions yet
Easy

Initials From a Name

Build uppercase initials from a full name.

You'll learn String splittingUppercase
BeginnerLearning-pathStrings
No solutions yet
Easy

Largest of Three

Pick the largest of three numbers without a built-in max.

You'll learn ComparisonsCombining conditions
BeginnerConditionsLearning-path
No solutions yet
Easy

Replace Spaces With Dashes

Turn spaces into dashes to make a URL-style slug.

You'll learn String buildingCharacter replacement
BeginnerLearning-pathStrings
No solutions yet
Easy

Count Uppercase Letters

Count the capital letters in a text.

You'll learn Character checksCounting
BeginnerLearning-pathStrings
No solutions yet
Easy

First Negative Index

Find where the first negative number appears.

You'll learn Linear searchEarly return
ArraysBeginnerLearning-path
No solutions yet
Easy

Count Positive Numbers

Count the values greater than zero in a list.

You'll learn ListsCounting
ArraysBeginnerLearning-path
No solutions yet
Easy

Median of a List

Find the middle value of a list after sorting.

You'll learn SortingStatistics
Arraysmath
No solutions yet
Easy

Odd, Even, or Neither

Classify a number by whether it is an odd integer, an even integer, or neither.

You'll learn ModuloConditions
BeginnerNumbers
No solutions yet
Easy

Count Vowels

Count the vowels in a piece of text.

You'll learn Character checksSet membership
BeginnerStringsStudent-beginner
No solutions yet
Easy

Hamming Distance

Compare two DNA strings position by position and count the differences.

You'll learn String comparisonCounting
SequencesStrings
No solutions yet
Medium

A* Search on a Weighted Grid

Find the cheapest path across a grid of terrain costs with A*, the search algorithm behind game and robot pathfinding.

You'll learn A* searchHeuristics
GraphsGridsShortest-pathai
No solutions yet
Medium

Value Iteration

Compute how valuable each state of a Markov decision process is by repeatedly applying the Bellman optimality update.

You'll learn Bellman equationMDPs
Reinforcement learningaimachine learning
No solutions yet
Easy

Above-Average Values

Keep the values that are greater than the average.

You'll learn Two passesFiltering
ArraysBeginnerLearning-path
No solutions yet
Easy

Fizz Buzz

Build a sequence using divisibility by 3 and 5.

You'll learn ConditionsDivisibility
BeginnerNumbers
No solutions yet