Loops and Number Problems Python practice problems
Build loop confidence with counters, accumulators, digit logic, primes, and classic sequences.
Core concepts
Problem-solving patterns
- Initialize → repeat → update → finish
Reported company tags
All 20 problems in this topic
Work from top to bottom to build the concept gradually.
- #041Sum the first n integers: Weekly countersBeginnerPremium
Add counters numbered 1 through 10 for a simple progress total.
- #042Sum the first n integers: Empty rangeBeginnerPremium
Confirm that summing through zero leaves the initial total unchanged.
- #043Calculate a factorial: Arrangement countBeginnerPremium
Find the number of arrangements of six distinct display items.
- #044Calculate a factorial: Zero factorialBeginnerPremium
Verify the factorial definition for an empty arrangement.
- #045Print a multiplication table: Practice tableBeginnerPremium
Generate the standard ten-line multiplication table for 7.
- #046Print a multiplication table: Negative tableBeginnerPremium
Observe the same loop with a negative base number.
- #047Count digits in an integer: Large invoice numberBeginnerPremium
Count how many digits appear in an invoice identifier.
- #048Count digits in an integer: Signed single digitBeginnerPremium
Ignore the minus sign when counting a negative single-digit value.
- #049Reverse an integer: Reverse an access codeBeginnerPremium
Reverse the digits of a numeric access code.
- #050Reverse an integer: Negative value with zerosBeginnerPremium
Reverse a negative number and naturally discard leading zeros in the result.
- #051Check a numeric palindrome: Symmetric codeBeginnerPremium
Check whether a five-digit gate code reads the same backward.
- #052Check a numeric palindrome: Ordinary numberBeginnerPremium
Reject a number whose reverse is different.
- #053Test primality: Prime identifierBeginnerPremium
Check whether 29 can be used as a prime-sized hash table example.
- #054Test primality: Small edge caseBeginnerPremium
Remember that 1 is neither prime nor composite.
- #055List primes up to n: Small prime catalogBeginnerPremium
List all prime numbers that do not exceed 20.
- #056List primes up to n: Boundary primeBeginnerPremium
Include the upper bound when it is itself prime.
- #057Generate Fibonacci terms: Ten-term sequenceBeginnerPremium
Generate ten Fibonacci terms for a learning dashboard.
- #058Generate Fibonacci terms: Single-term edge caseBeginnerPremium
Return only the starting value when one term is requested.
- #059Find GCD and LCM: Align maintenance cyclesBeginnerPremium
Find when 18-day and 24-day maintenance cycles align, along with their GCD.
- #060Find GCD and LCM: Coprime valuesBeginnerPremium
Calculate GCD and LCM for values that share no factor above 1.