Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Strategy solution in Creative category for Fizz Buzz by swagg010164
def checkio(number: int) -> str:
strat = {lambda x: x % 5 == 0 and x % 3 == 0: "Fizz Buzz",
lambda x: x % 3 == 0: "Fizz",
lambda x: x % 5 == 0: "Buzz",
lambda x: 1: str(number)
}
for func in strat:
if func(number):
return strat[func]
Nov. 8, 2019