Last active
August 29, 2015 14:17
-
-
Save aymanosman/9ca0eda95073d669cc91 to your computer and use it in GitHub Desktop.
fz.py
This file contains 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 fizz(n): | |
for i in xrange(1, n+1): | |
print i, fz(i) | |
def t(m, s, n): | |
return s if (n%m==0) else '' | |
def fz(n): | |
s = ''.join([ | |
t(3, 'Fizz', n), | |
t(5, 'Buzz', n), | |
t(7, 'Hiss', n) | |
]) | |
return s if s != '' else str(n) | |
if __name__ == '__main__': | |
fizz(21) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment