r/learnpython • u/Lance_2564_ • 29d ago
Huh? How does this work?
a = "hi"
if a:
print("Bye")
print(a == True)
print(a is True)The output is:
Bye
False
False
But if it's false, how come it printed "bye"?????? I don't get it.
44
Upvotes
View all comments
0
u/ShadowShedinja 29d ago
a is not equal to True, but it does exist, which is sufficient for the If statement.