Loops and Repeated Work Python lessons
for, while, counters, accumulators, ranges, and stopping conditions.
Core concepts
Problem-solving patterns
- for loop · accumulator
- factorial · loop
- range · formatting
- while loop · digits
- while loop · modulo
What this topic builds
Learn the idea once, trace it through two verified cases, then explain why your approach works.
All 10 lessons in this topic
Work from top to bottom to build each concept gradually.
- #021Sum the first n integersStarterPremium
Add counters numbered 1 through 10 for a simple progress total.
- #022Calculate a factorialStarterPremium
Find the number of arrangements of six distinct display items.
- #023Print a multiplication tableBeginnerPremium
Generate the standard ten-line multiplication table for 7.
- #024Count digits in an integerBeginnerPremium
Count how many digits appear in an invoice identifier.
- #025Reverse an integerBeginnerPremium
Reverse the digits of a numeric access code.
- #026Check a numeric palindromeBeginnerPremium
Check whether a five-digit gate code reads the same backward.
- #027Test primalityIntermediatePremium
Check whether 29 can be used as a prime-sized hash table example.
- #028List primes up to nIntermediatePremium
List all prime numbers that do not exceed 20.
- #029Generate Fibonacci termsIntermediatePremium
Generate ten Fibonacci terms for a learning dashboard.
- #030Find GCD and LCMAdvancedPremium
Find when 18-day and 24-day maintenance cycles align, along with their GCD.