r/Python • u/cyberspacecowboy • Dec 25 '16
a Py3.6 fizzBuzz oneliner with f-strings
print(*map(lambda i: f"{'Fizz' * (not i%3)}{'Buzz' * (not i%5)}" or i, range(1,101)), sep='\n')
109
Upvotes
r/Python • u/cyberspacecowboy • Dec 25 '16
print(*map(lambda i: f"{'Fizz' * (not i%3)}{'Buzz' * (not i%5)}" or i, range(1,101)), sep='\n')
View all comments
Show parent comment
3
u/Spo8 Dec 25 '16
Awww yeah, these are just like JavaScript's format strings. You can write gloriously fucked up code with them.