I am new to programming so apologies for not being able to frame the question properly but here's a more detailed version of the problem. If I run the following code:
age=2
if age:
print("hello")
else:
print("bye")
Output is "hello" which I read was due to age being evaluated to True.
But when I modify it to:
age=2
if age is True:
print("hello")
else:
print("bye")
The Output is "bye"
I was expecting the Output here to be True. Where is the gap in my understanding? I Would also be grateful if you could direct me to a link to study the topic. Thanks
Aucun commentaire:
Enregistrer un commentaire