We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8850af9 commit 895fb03Copy full SHA for 895fb03
fizzbuzz.py
@@ -0,0 +1,21 @@
1
+def fizzbuzz(yourNum):
2
+ if yourNum < 1:
3
+ return "Fail!"
4
+ if yourNum % 3 == 0 and yourNum % 5 != 0:
5
+ return "Fizz"
6
+ if yourNum % 3 != 0 and yourNum % 5 == 0:
7
+ return "Buzz"
8
+ if yourNum % 3 == 0 and yourNum % 5 == 0:
9
+ return "FizzBuzz"
10
+ return input
11
+
12
+def test_fizzbuzz():
13
+ assert fizzbuzz(0) == "Fail!"
14
+ assert fizzbuzz(-1) == "Fail!"
15
+ assert fizzbuzz(3) == "Fizz"
16
+ assert fizzbuzz(6) == "Fizz"
17
+ assert fizzbuzz(5) == "Buzz"
18
+ assert fizzbuzz(10) == "Buzz"
19
+ assert fizzbuzz(15) == "FizzBuzz"
20
+ assert fizzbuzz(30) == "FizzBuzz"
21
0 commit comments