Ad
Code
Diff
  • def fizz_buzz(m):
        return ["Fizz"*int(n%3==0)+"Buzz"*int(n%5==0)  if (n%3==0 or n%5==0) else n for n in range(1,m)]
        
    • def fizz_buzz(n):
    • return ['FizzBuzz' if (i % 15 == 0) else 'Fizz' if(i % 3 == 0) else 'Buzz' if(i % 5 == 0) else i for i in range(1,n)]
    • def fizz_buzz(m):
    • return ["Fizz"*int(n%3==0)+"Buzz"*int(n%5==0) if (n%3==0 or n%5==0) else n for n in range(1,m)]