So I thought I found a typo in code I was working on. I thought 'not' would operate on string "eta" and make it False and False is not in the List,so nothing should print - however in both the below case "Eta not found" is printed. I guess this has something to do with order of evaluation that both statements are equal.
if not "eta" in ["alpha", "beta", "gamma"]:
print ("Eta not found")
if "eta" not in ["alpha", "beta", "gamma"]:
print ("Eta not found")
Aucun commentaire:
Enregistrer un commentaire