def fizzBuzz(num): if (num % 5) and (not num % 3): return "Fizz" if (num % 3) and (not num % 5): return "Buzz" if (not num % 3) and (not num % 5): return "FizzBuzz" return str(num)
- def fizzBuzz(num):
if num % 3 == 0 and num % 5 != 0:- if (num % 5) and (not num % 3):
- return "Fizz"
if num % 3 != 0 and num % 5 == 0:- if (num % 3) and (not num % 5):
- return "Buzz"
if num % 3 == 0 and num % 5 == 0:- if (not num % 3) and (not num % 5):
- return "FizzBuzz"
- return str(num)