r/learnpython • u/Lance_2564_ • Oct 19 '26
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.
47
Upvotes
View all comments
1
u/TheRNGuy Oct 19 '26
Implicit conversion, because
ais not empty, and==andisdo not cause implicit conversion.