Write a function called fizz_buzz that takes a number.
If the number is divisible by 3, it should return “Fizz”.
If it is divisible by 5, it should return “Buzz”.
If it is divisible by both 3 and 5, it should return “FizzBuzz”.
Otherwise, it should return the same number.
def fizzbuzz(num):
	if num%3 == 0 or num%5 == 0:
		s = ''
		if num%3 == 0:
			s += 'Fizz'
		if num%5 == 0:
			s += 'Buzz'
		return s
	else:
		return num
print(fizzbuzz(3))
print(fizzbuzz(5))
print(fizzbuzz(15))
print(fizzbuzz(4))
Comments