Suppose I have a dictionary d={1:'abc',2:'def'}. Python gives boolean output in statements 1 in d-> TRUE. But if I use the same in If Condition, its always returning FALSE:
What am I failing to understand here?
Suppose I have a dictionary d={1:'abc',2:'def'}. Python gives boolean output in statements 1 in d-> TRUE.
But if I use the same in If Condition, its always returning FALSE:
a=1
if a in d: # Loop jumps to else directly
print wow!
else:
print wowow!
I expect the if condition to be true with dictionary
Aucun commentaire:
Enregistrer un commentaire