Collatz steps
Count how many steps the Collatz sequence takes to reach 1 from n.
Factorial (iterative)
Compute n! iteratively without recursion.
Power of two?
Return True if n is an exact power of 2.
GCD via Euclid
Compute the greatest common divisor of two positive integers.
Prime checker
Return True if n is a prime number.
Compound interest
Return the future balance after compound interest, rounded to two decimals.
Absolute Difference of Two Integers
Compute the absolute difference between two integers, regardless of order.
Sum from 1 to n
Write a function that returns the sum of all integers from 1 to n (inclusive).
Circle Circumference Calculator
Implement a function that computes the circumference of a circle from its radius using the formula 2πr.
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.
Hexagonal Number
Write a function to check if a positive integer is a hexagonal number.
Count trailing zeros
Write a function that counts the number of trailing zeros in the decimal representation of a positive integer.
Showing 13 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.