Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions fizzbuzz.py
Original file line number Diff line number Diff line change
@@ -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()