Last active
December 23, 2015 09:09
-
-
Save armonge/6612856 to your computer and use it in GitHub Desktop.
Kata #1 (Python) Webcast Agilityfeat. https://plus.google.com/114642677983172790710/posts/erAyjcXgkLp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fizzbuzz(num): | |
if num == 0: | |
return '0' | |
if num % 3 == num % 5 == 0: | |
return 'fizzbuzz' | |
if num % 3 == 0: | |
return 'fizz' | |
if num % 5 == 0: | |
return 'buzz' | |
return str(num) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fizzbuzz import fizzbuzz | |
def test_clasify_as_is(): | |
assert fizzbuzz(1) == '1' | |
assert fizzbuzz(0) == '0' | |
def test_clasify_as_fizz(): | |
assert fizzbuzz(3) == 'fizz' | |
assert fizzbuzz(6) == 'fizz' | |
def test_clasify_as_buzz(): | |
assert fizzbuzz(5) == 'buzz' | |
assert fizzbuzz(10) == 'buzz' | |
def test_clasify_as_fizzbuzz(): | |
assert fizzbuzz(15) == 'fizzbuzz' | |
assert fizzbuzz(30) == 'fizzbuzz' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment