Skip to content

Instantly share code, notes, and snippets.

@oyvindrobertsen
Created October 27, 2013 20:49
Show Gist options
  • Save oyvindrobertsen/7187715 to your computer and use it in GitHub Desktop.
Save oyvindrobertsen/7187715 to your computer and use it in GitHub Desktop.
def fizzBuzz(n):
pos = [["FizzBuzz", "Fizz"], ["Fizz", ""]]
for i in range(n):
a = int(math.ceil((i%3) / float(n)))
b = int(math.ceil((i%5) / float(n)))
print i , ": " , pos[a][b]
fizzBuzz(100)
@mathiasose
Copy link

print (str(i) + pos[a][b])[-len(pos[a][b]):]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment