Python Fizzy Buzzy

for num in range(1,54):
if num % 5 == 0 and num % 3 == 0:
print("FizzyBuzzy")
elif num % 3 == 0:
print("Fizzy")
elif num % 5 == 0:
print("Buzzy")
else:
print(num)

Result:

1
2
Fizzy
4
Buzzy
Fizzy
7
8
Fizzy
Buzzy
11
Fizzy
13
14
FizzyBuzzy
16
17
Fizzy
19
Buzzy
Fizzy
22
23
Fizzy
Buzzy
26
Fizzy
28
29
FizzyBuzzy
31
32
Fizzy
34
Buzzy
Fizzy
37
38
Fizzy
Buzzy
41
Fizzy
43
44
FizzyBuzzy
46
47
Fizzy
49
Buzzy
Fizzy
52
53

By DuaneGallaher

Musician, bicycle mechanic, eBike enthusiast, former mainframe developer becoming web developer, all around curious person with passion for solving problems.

Leave a Reply