def fizz_buzz(num):
if num % 3 == 0 and num % 5 == 0:
return "Fizz Buzz"
elif num % 3 == 0:
return "Fizz"
elif num % 5 == 0:
return "Buzz"
return num
fizz_buzz(15)
- I don't know why my
return
statement is working. - Conditions are aligned properly
- I referred this code:
- He used
input
instead I usednum
- I don't want to use
input
shown in reference code
Aucun commentaire:
Enregistrer un commentaire