lundi 25 mai 2015

Executing code after if/else

Question around executing something after it comes after an if-statement. How do I get this code to return "i love wombats" despite whatever if/else result happens? ie. I want to return "i love wombats" every time this runs.

def is_wombats(x):
    if x.lower() == "wombat":
        return "yay wombats"
    else:
        return "no wombats"
    return "i love wombats"

print is_wombats("WOMbat")

TLDR: why isn't the return statement after if/else executing?

Aucun commentaire:

Enregistrer un commentaire