We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 79e59ae + 1464d9e commit 161ab3eCopy full SHA for 161ab3e
FizzBuzz.py
@@ -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