"or" apparently is not working?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Lfzinho
if "a"=="b"or"c":
	print("these strings are equal")

This prints “these strings are equal” in the output but it shoudn’t (I guess). I want it to print only when the first value is “b” or “c”, what can I do?

:bust_in_silhouette: Reply From: jgodfrey

You want:

if "a" == "b" or "a" == "c":
    print("the same")

Though, “a” is neither “b” or “c”, so it won’t print the message…

Thanks! I figured that out as soon as I read my question again lol. It’s kinda dumb but who never did something like that haha

Lfzinho | 2020-06-21 01:38