jeudi 1 novembre 2018

When is self statement true and when is false?

Can someone explain this if self.cards condition? When will it be True and when will it be False?

def __str__(self):
    if self.cards:
        rep = ""
        for card in self.cards:
            rep += str(card) + " "
    else:
        rep = "<empty>"
    return rep

Aucun commentaire:

Enregistrer un commentaire