lundi 19 février 2018

How to avoid 'else' in this case?

Is there a better way to do this? A friend told me to avoid else, in order to keep the code clean, but i can't figure out another way to do this.

if listA[0] in listB:
    k = listA[0]
else:
    k = listB[1]

Aucun commentaire:

Enregistrer un commentaire