diff --git a/recipes/Python/576612_FizzBuzz/recipe-576612.py b/recipes/Python/576612_FizzBuzz/recipe-576612.py index 33ca9d33b..ef0ba3fc3 100644 --- a/recipes/Python/576612_FizzBuzz/recipe-576612.py +++ b/recipes/Python/576612_FizzBuzz/recipe-576612.py @@ -1,5 +1,9 @@ -n=map(str, range(101)) -n[::3]=['Fizz']*34 -n[::5]=['Buzz']*21 -n[::15]=['FizzBuzz']*7 -print '\n'.join(n[1:]) +from __future__ import division +from math import ceil + +N = 101 +n = range(N) +n[::3]=['Fizz']*int(ceil(N/3)) +n[::5]= [ t + "Buzz" if type(t) == str else "Buzz" for t in n[::5] ] + +print '\n'.join(str(n) for n in n[1:])