lundi 7 juin 2021

Why does the following python code print 4 lines instead of 3? [closed]

def beauty():
    print("Belle")
    return "Beast"

def gaston():
    if beauty() == "Beast":
        print("No one’s as slick")
    elif beauty() == None:
        print("No one’s as quick")
    if beauty() == "Belle":
        print("What a guy")
    else:
        print("Belle")  

gaston()

Can anyone please explain why the code above is printing 4 lines instead of 3?

Aucun commentaire:

Enregistrer un commentaire