Classic FizzBuzz implementation in Python - prints numbers 1-100 with "Fizz" for multiples of 3, "Buzz" for multiples of 5, and "FizzBuzz" for multiples of both.
- Prints numbers 1 to 100
- "Fizz" for multiples of 3
- "Buzz" for multiples of 5
- "FizzBuzz" for multiples of both 3 and 5
- Written in β€10 lines of code
- Python 3.11
- F-strings for formatted output
This project focuses on:
- For loops with range()
- Modulo operator (%) for divisibility checks
- Conditional logic and order of operations
- Writing concise, efficient code
python fizzbuzz.py1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
...
- Why order matters in conditionals (check 15 before checking 3 or 5)
- The power of the modulo operator for pattern detection
- How to write compact, readable code
- F-strings make output formatting cleaner
The key insight is checking divisibility by 15 FIRST:
if i % 15 == 0: # Must check this before % 3 or % 5
print("FizzBuzz")Built as part of my ML Engineering Roadmap - December 2025