I feel like I've somehow misunderstood the fundamental concept of how the 'or' keyword works in Python.
I have the following code:
word = "aarrgh"
print(*[x for x in word if x == "a" or "r"])
and this is giving me:
a a r r g h
The same thing happens when using ==
or !=
.
What am I missing here? I cant find anything online explaining this so sorry if this is something obvious.