Factorial (iterative)
Compute n! iteratively without recursion.
Clamp a Number to a Range
Implement a clamp function that returns a value within a specified range.
Max of a variable-length list
Implement a function that returns the maximum value from a list of numbers without using max().
Replace negatives with zero
Implement a function that replaces all negative numbers in a list with zero.
Minutes to Hours: Time Conversion Helper
Write a function that converts minutes into a human-readable 'Xh Ym' string, with special cases for zero and whole hours.
Is divisible by?
Create a function that returns True if a is divisible by b with no remainder, with a clear definition of edge cases.
Modulo Remainder
Implement a function that returns the remainder of a divided by b without using the modulo operator.
Digit Count
Count the number of digits in an integer using arithmetic, without string conversion.
Find Missing Number
Given a list of n distinct integers from 0..n with one missing, return the missing number.
Enumerate with start
Implement a function that mimics Python's enumerate with a custom start index.
Convolve 1D signal
Implement a 1D convolution function with three modes using pure Python.
Guess Number Game
Simulate a number guessing game with attempts, feedback, and a win/lose result.
Longest Substring with K Repeating Characters
Return the length of the longest substring of a given string in which every character appears at least K times.
Basic Calculator
Implement a function that evaluates a simple arithmetic expression with +, -, *, / and parentheses.
Broadcast Add Scalar
Add a scalar to every number in a 2D list and return a new 2D list without modifying the original.
Reshape array dimensions
Implement a function that reshapes a 1D list into a 2D list with given dimensions.
Showing 16 challenges · Python Basics
Python Basics — Python coding challenges
What you will find here
This page lists python basics challenges — real Python problems you solve in the browser IDE with instant test feedback. Each challenge includes a clear brief, starter code, and automated checks.
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.