Python Beginner
Code only
FizzBuzz in Python
The classic loop exercise, written clearly.
For each number, check divisibility by 15 first, then 3, then 5.
for n in range(1, 21):
if n % 15 == 0:
print("FizzBuzz")
elif n % 3 == 0:
print("Fizz")
elif n % 5 == 0:
print("Buzz")
else:
print(n)
Code only · preview unavailable
Python code runs on a server or your own computer, so it is not run here. Copy or download it and try it in your own environment.