Ad

A cool alternative

Code
Diff
  • def fizz_buzz(n):
        return (not(n % 3))*"Fizz" + (not(n % 5))*"Buzz" if not(n % 3) or not(n % 5) else str(n)
    
    • def fizz_buzz(n):
    • return "FizzBuzz" if n % 15 == 0 else "Fizz" if n % 3 == 0 else "Buzz" if n % 5 == 0 else str(n)
    • return (not(n % 3))*"Fizz" + (not(n % 5))*"Buzz" if not(n % 3) or not(n % 5) else str(n)