Skip to content

Instantly share code, notes, and snippets.

@aymanosman
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aymanosman/9ca0eda95073d669cc91 to your computer and use it in GitHub Desktop.
Save aymanosman/9ca0eda95073d669cc91 to your computer and use it in GitHub Desktop.
fz.py
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