4 ms·
Very nice. If you make the generator always return a string, then you can make it print, thus: print '\n'.join((not x % 3) * 'Fizz' + (not x % 5) * 'Buzz'
by cynwoody 13y ago
Very nice.
If you make the generator always return a string, then you can make it print, thus:
print '\n'.join((not x % 3) * 'Fizz' + (not x % 5) * 'Buzz' or str(x) for x in range(1, 101))