Skip to content

Commit 1760d7b

Browse files
Create FizzBuzz.py
# FizzBuzz # A program that prints the numbers from 1 to num (User given number)! # For multiples of ‘3’ print “Fizz” instead of the number. # For the multiples of ‘5’ print “Buzz”. # If the number is divisible by both 3 and 5 then print "FizzBuzz". # If none of the given conditions are true then just print the number!
1 parent 5991a21 commit 1760d7b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

FizzBuzz.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def FizzBuzz():
2+
num = int(input("Enter the number here: "))
3+
for i in range(1, num+1):
4+
if i%3 == 0 and i%5 == 0:
5+
print("FizzBuzz")
6+
elif i%3 == 0:
7+
print("Fizz")
8+
elif i%5 == 0:
9+
print("Buzz")
10+
else:
11+
print(i)
12+
13+
FizzBuzz()

0 commit comments

Comments
 (0)