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
20 changes: 19 additions & 1 deletion fizzbuzz.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# add your code here
# Iterate through numbers from 0 to 100 using the range function
for fizzbuzz in range(101):
# Check if the current number is divisible by both 3 and 5 (i.e., divisible by 15)
if fizzbuzz % 3 == 0 and fizzbuzz % 5 == 0:
# If divisible by both 3 and 5, print "fizzbuzz" and continue to the next iteration
print("fizzbuzz")
continue
# Check if the current number is divisible only by 3
elif fizzbuzz % 3 == 0:
# If divisible only by 3, print "fizz" and continue to the next iteration
print("fizz")
continue
# Check if the current number is divisible only by 5
elif fizzbuzz % 5 == 0:
# If divisible only by 5, print "buzz" and continue to the next iteration
print("buzz")
continue
# If the number is neither divisible by 3 nor 5, print the number itself
print(fizzbuzz)