mercredi 7 décembre 2016

Python - if not condition returning None

This is another question from Python - does IF NOT statement implicitly check 2 conditions?

I am trying to further clarify the concept with ifstatement using not. My understanding is that print secondFunction(True) will return True since randomFunction will be called but the script is returning None. Please help!

def randomFunction(value):
    if value:
        return True
    else:
        return False

    def secondFunction(v):
        if not randomFunction(v):
            return "minus it"

print secondFunction(True)

Aucun commentaire:

Enregistrer un commentaire