Write a program that processes a list of numbers from 1 to 100. For each number, if the number is a multiple of 3, print “FIZZ”; if the number is a multiple of 5, print “BANG”; otherwise, print the number.
You are *NOT* allowed to use any *IF/ELSE* statements in your code. You can use the list-accessing ternary operator hack, but whilst I’ll accept your homework if you do, you’ll miss out on the prize (alcoholic), which goes to the most concise code (not including whitespace).
Here's my final solution:
for i in range(1, 101):
f = (i % 3 == 0) and "FIZZ" or ""
b = (i % 5 == 0) and f + "BANG" or f + ""
n = (len(b) > 0) and b or i