Python loop exercises
Practice for and while loops on problems that check your answer with tests as soon as you submit.
Beginner
- 204. Rocket CountdownThe last seconds before a rocket leaves the launch pad25 XP3 min
- 207. Times TableThe multiplication table, written out line by line25 XP4 min
- 214. Collatz StepsA famous unsolved puzzle about numbers that always seem to fall to 130 XP5 min
- 520. Sum of MultiplesAdding up the threes and fives, and coming up short25 XP3 min
- 524. The Priciest ItemWhich thing in the shopping basket cost the most?25 XP3 min
- 525. Total of the Odd NumbersAdd up every odd number between two bookends25 XP3 min
- 526. Triangular NumbersStack bowling pins in rows: how many pins does each triangle need?25 XP4 min
- 539. Count the Leap YearsHow many February 29ths fall between two years?30 XP5 min
- 541. Did Everyone Pass?A class report that is far too optimistic30 XP4 min
- 542. Double FactorialA factorial that skips every other number30 XP4 min
- 552. Star StaircaseDraw a staircase of stars that climbs to the right30 XP5 min
- 554. The Biggest DigitWhich digit wins inside a long number?30 XP5 min
- 566. Floyd's TriangleCount upward and stack the numbers into a growing triangle35 XP6 min
- 567. Multiplication SquareThe whole multiplication chart from the classroom wall35 XP6 min
Intermediate
- 16. Sum of DigitsAdd up the digits of a number55 XP5 min
- 20. FactorialThe product of every number up to n65 XP6 min
- 21. Fibonacci SequenceThe sequence where each number adds the two before70 XP7 min
- 22. FizzBuzzFizz, Buzz or a number: the classic counting game75 XP8 min
- 23. Prime Number CheckIs this number divisible only by 1 and itself?80 XP8 min
- 270. Happy NumbersSome numbers find their way to 1, others wander in circles forever60 XP10 min
Other topics
- Python Basics
- Strings
- Lists
- Dictionaries and sets
- Functions
- Math
- Errors and exceptions
- File handling
- Modules and random
- Sorting and searching
- Two pointers
- Sliding window
- Stacks and queues
- Recursion and backtracking
- Dynamic programming
- Greedy
- Graphs
- Trees
- Bit manipulation
- Classes
- Iterators and generators
- Parsing
- Simulation
- Python idioms
- Regular expressions
- Codes and ciphers
- Working with data
- Grids and matrices
- Geometry
- Games and puzzles
- Heaps
- Data structures
Or see every challenge, with study plans, today's challenge and duels.