r/Python • • Jan 23 '17

Share your unusual fizzbuzz approaches!

Dear /r/Python, I would like you to share your FizzBuzz. Here is mine:

import numpy as np

fb = np.arange(101, dtype='object')
fb[::3] = 'Fizz'
fb[::5] = 'Buzz'
fb[::15] = 'FizzBuzz'

print(*fb[1:], sep='\n')
5 Upvotes

20 comments sorted by

View all comments

Show parent comment

3

u/zabolekar Jan 24 '17

Why not not not

for i in range(1, 101): print((((i, "Fizz")[not i%3], "Buzz")[not i%5], "FizzBuzz")[not i%15])

?