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

Fizz Buzz

Build a sequence using divisibility by 3 and 5.

You'll learn ConditionsDivisibility
BeginnerNumbers
No solutions yet
Medium

One Generation of a Genetic Algorithm

Breed the next generation of bit strings with tournament selection, single-point crossover and mutation.

You'll learn Genetic algorithmsEvolutionary search
OptimizationSimulationai
No solutions yet
Easy

Second Largest Value

Find the second largest distinct value.

You'll learn Two trackersDistinct values
ArraysBeginnerStudent-beginner
No solutions yet
Easy

Array Maximum

Find the largest value in a list.

You'll learn Tracking a maximumSingle pass
ArraysBeginnerStudent-beginner
No solutions yet
Easy

Array Minimum

Find the smallest value in a list.

You'll learn Tracking a minimumSingle pass
ArraysBeginnerStudent-beginner
No solutions yet
Medium

Q-Learning Updates

Apply the Q-learning update to a stream of experiences and watch rewards flow back to earlier states.

You'll learn Q-learningDiscounted rewards
Reinforcement learningaimachine learning
No solutions yet
Medium

Forward Propagation in a Two-Layer Network

Run inputs through a hidden ReLU layer and a sigmoid output layer.

You'll learn Forward passMulti-layer networks
Neural networksaimachine learning
No solutions yet
Easy

Longest Word

Find the longest word in a sentence.

You'll learn String splittingTracking a maximum
BeginnerStringsStudent-beginner
No solutions yet
Easy

Epsilon-Greedy Multi-Armed Bandit

Balance exploration and exploitation on a multi-armed bandit with epsilon-greedy action selection.

You'll learn Explore vs exploitBandits
Reinforcement learningaimachine learning
No solutions yet
Medium

Perceptron Learning Algorithm

Train the original perceptron, which updates its weights only when it makes a mistake.

You'll learn PerceptronOnline learning
Neural networksaimachine learning
No solutions yet
Easy

Classify a Number by Its Divisors

Classify a positive integer as perfect, abundant, or deficient.

You'll learn DivisorsClassification
BeginnerNumber-theory
No solutions yet
Easy

Pascal’s Triangle

Build rows by adding neighboring entries from the previous row.

You'll learn 2D listsBuilding from previous rows
ArraysCombinatorics
No solutions yet
Easy

Count Words

Count the words in a sentence.

You'll learn String splittingWhitespace
BeginnerStringsStudent-beginner
No solutions yet
Easy

Running Sum

Replace each value with the total so far.

You'll learn Prefix sumsLists
ArraysBeginnerLearning-path
No solutions yet
Easy

Array Average

Compute the average of a list of numbers.

You'll learn Sum and countFloat division
ArraysBeginnerStudent-beginner
No solutions yet
Easy

Move Zeroes

Move every zero to the end while keeping the other order.

You'll learn Two pointersIn-place updates
ArraysBeginnerStudent-beginner
No solutions yet
Easy

Activation Functions

Apply sigmoid, ReLU, Leaky ReLU or tanh to every value in a list.

You'll learn SigmoidReLU and tanh
Neural networksaimachine learning
No solutions yet
Easy

Rotate Array

Rotate a list to the right by some steps.

You'll learn Array indexingModulo
ArraysBeginnerStudent-beginner
No solutions yet