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

Average of Three

Average three whole numbers.

You'll learn ArithmeticDivision
BeginnerLearning-pathVariables
Hard

Mini Stack-Language Interpreter

Evaluate a small stack language.

You'll learn TokenizingExecuting instructions
InterpretersParsingStacks
No solutions yet
Hard

Count Inversions

Count the out-of-order pairs in a list.

You'll learn Merge sortDivide and conquer
AdvancedCompetitive-programmingSorting
No solutions yet
Hard

Trapping Rain Water

Compute how much rain water an elevation map holds.

You'll learn Two pointersPrefix maxima
AdvancedArraysCompetitive-programmingGreedy
No solutions yet
Medium

Island Perimeter

Measure the coastline of land cells in a grid.

You'll learn Edge counting4-neighbor checks
AdvancedGridsHackathon
No solutions yet
Easy

Pyramid Rows

Draw a right-aligned pyramid of # blocks.

You'll learn String patternsPadding
BeginnerLearning-pathNested-loopsPatterns
No solutions yet
Easy

Rectangle Perimeter

Compute the perimeter of a rectangle from its sides.

You'll learn ArithmeticReturn values
BeginnerLearning-pathVariables
Hard

Sliding Window Maximum

Report the maximum of every window of k numbers.

You'll learn Monotonic dequeO(n) windows
AdvancedCompetitive-programmingSliding-window
No solutions yet
Easy

Hollow Square

Draw the outline of a square with * characters.

You'll learn Edge detectionBuilding strings
BeginnerLearning-pathNested-loopsPatterns
No solutions yet
Medium

Recursive Palindrome

Check a palindrome recursively, ignoring case and punctuation.

You'll learn Base casesString cleaning
BeginnerLearning-pathRecursionStrings
No solutions yet
Easy

Days in a Month

Return how many days a month has, including leap years.

You'll learn Calendar rulesHelper functions
BeginnerConditionsFunctionsLearning-path
No solutions yet
Easy

Celsius to Fahrenheit

Convert a temperature from Celsius to Fahrenheit.

You'll learn FormulasOperator precedence
BeginnerLearning-pathVariables
No solutions yet
Easy

Cash: Fewest Coins

Give change with as few U.S. coins as possible.

You'll learn Greedy algorithmsCoin change
BeginnerGreedyStudent-beginnermath
No solutions yet
Medium

Tic-Tac-Toe Winner

Decide the result of a tic-tac-toe board.

You'll learn Win conditionsDiagonals
BeginnerConditionsGridsLearning-path
No solutions yet
Easy

Fibonacci Number

Return the n-th Fibonacci number.

You'll learn IterationUpdating two variables
BeginnerLoopsSequencesStudent-beginner
No solutions yet
Medium

Find Right-Triangle Triples

List all integer right triangles with a specified perimeter.

You'll learn EnumerationAvoiding duplicates
GeometryNumber-theory
No solutions yet
Hard

Matrix Chain Multiplication

Find the cheapest order to multiply a chain of matrices.

You'll learn Interval DPOptimization
AdvancedCompetitive-programmingDynamic-programming
No solutions yet
Medium

Count Grid Paths

Count routes across a rectangular grid using only right and down moves.

You'll learn Grid path countingBinomial coefficients
CombinatoricsDynamic-programming
No solutions yet