vendredi 30 décembre 2016

what can be a statement after if?

def check():
    if [1,2,3]:
        return [2,3,4]

check()
[2, 3, 4]

I thought [1,2,3] is a list but not a Boolean expression that can be True or False? But why does the function consider the list ([1,2,3]) to be True?

Aucun commentaire:

Enregistrer un commentaire