r/Python • u/zabolekar • 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')
4
Upvotes
View all comments
Show parent comment
3
u/spidyfan21 Jan 23 '17
Similarly
list(map(lambda x: 'Fizz'*(x % 3 == 0) + 'Buzz'*(x % 5 == 0) or x, range(1, 100)))