Suppose this code
x = "boo"
if "a" or "z" in x:
print(True)
else:
print(False)
returns True.
But why?
I expected it to return False, becuause neither a nor z is in x.
Do I misunderstand in
?
I frequently use in
to see if a string contains a single substring. E.g.
x = "eggs and spam"
if "spam" in x:
return "add sausage"