Playing Fizz Buzz

A very typical test of programming skills is doing a short one-liner for something that is not easily a one-liner.

Today I did the FizzBuzz test. The task is simple; For a range of numbers 1..100 print “Fizz” if the number is divisible by 3 and “Buzz” if the number is divisible by 5, otherwise just print the number.

Python is my weapon of choice.

print(*map(lambda n:"Fizz"*(n%3==0)+"Buzz"*(n%5==0) or n, range(1,101)))

Don’t do this for production code 🙄