jeudi 28 janvier 2021

return statement not responding what should i do

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)
  1. I don't know why my return statement is working.
  2. Conditions are aligned properly
  3. I referred this code:

enter image description here

  1. He used input instead I used num
  2. I don't want to use input shown in reference code

Aucun commentaire:

Enregistrer un commentaire