Skip to content

Commit 161ab3e

Browse files
Merge pull request geekcomputers#1282 from Coder98321/master
Added the game FizzBuzz
2 parents 79e59ae + 1464d9e commit 161ab3e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

FizzBuzz.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# FizzBuzz
2+
# A program that prints the numbers from 1 to num (User given number)!
3+
# For multiples of ‘3’ print “Fizz” instead of the number.
4+
# For the multiples of ‘5’ print “Buzz”.
5+
# If the number is divisible by both 3 and 5 then print "FizzBuzz".
6+
# If none of the given conditions are true then just print the number!
7+
8+
9+
def FizzBuzz():
10+
num = int(input("Enter the number here: "))
11+
for i in range(1, num+1):
12+
if i%3 == 0 and i%5 == 0:
13+
print("FizzBuzz")
14+
elif i%3 == 0:
15+
print("Fizz")
16+
elif i%5 == 0:
17+
print("Buzz")
18+
else:
19+
print(i)
20+
21+
FizzBuzz()

0 commit comments

Comments
 (0)