Ad
Code
Diff
  • def fizzBuzz(num):
    
        if num % 15 == 0:
            return "FizzBuzz"
        elif num % 3 == 0:
            return "Fizz"
            
        elif num % 5 == 0:
            return "Buzz"
        else:
            return f"{num}"
    • def fizzBuzz(num):
    • if num % 3 == 0 and num % 5 != 0:
    • if num % 15 == 0:
    • return "FizzBuzz"
    • elif num % 3 == 0:
    • return "Fizz"
    • if num % 3 != 0 and num % 5 == 0:
    • elif num % 5 == 0:
    • return "Buzz"
    • if num % 3 == 0 and num % 5 == 0:
    • return "FizzBuzz"
    • return str(num)
    • else:
    • return f"{num}"