What is the better choice: single point return or multiple return functions?
##---------------------------- exercise
def fizz_buzz(input): # single point return
if input % 3 == 0 and input % 5 == 0:
result = "fizzbuzz"
if input % 3 == 0:
result = "fizz"
if input % 5 == 0:
result = "buzz"
else:
result = input
return result
def shizz_buzz(input): # Mosh way, the multiple return
if input % 3 == 0 and input % 5 == 0:
return "fizzbuzz"
if input % 3 == 0:
return "fizz"
if input % 5 == 0:
return "buzz"
else:
return input
print(fizz_buzz(7))
print(shizz_buzz(15))