Skip to content

HarveyPunsalan/FizzBuzz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 

Repository files navigation

🎲 FizzBuzz

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.

✨ Features

  • 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

πŸ› οΈ Technologies Used

  • Python 3.11
  • F-strings for formatted output

🎯 Learning Goals

This project focuses on:

  • For loops with range()
  • Modulo operator (%) for divisibility checks
  • Conditional logic and order of operations
  • Writing concise, efficient code

πŸš€ How to Run

python fizzbuzz.py

πŸ“ Output Sample

1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
...

🧠 What I Learned

  • 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

πŸ’‘ Code Insights

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages