From 09a4d6090279fcca5fc8f633eb553c6c5fdfc338 Mon Sep 17 00:00:00 2001 From: Katrina Baker Date: Fri, 1 Nov 2024 21:13:44 -0400 Subject: [PATCH] completed fizzbuzz --- fizzbuzz.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/fizzbuzz.py b/fizzbuzz.py index 218f7aa..04236ce 100644 --- a/fizzbuzz.py +++ b/fizzbuzz.py @@ -1,2 +1,14 @@ -# add your code here - +# Write a program that outputs the numbers from 1 to 100. All numbers that are divisible by three should be replaced by +# *Fizz* and all numbers that are divisible by 5 should be replaced by *Buzz*. Numbers that are divisible by both 3 and 5 +# will be replaced by "FizzBuzz". +def fizzbuzz(): + for num in range(1,101): + if(num % 3 == 0 and num % 5 == 0): + print("FizzBuzz") + elif(num % 5 == 0): + print("Buzz") + elif(num % 3 == 0): + print("Fizz") + else: + print(num) +fizzbuzz()