I have a piece of code:
x = 8
if x==3 or 4:
print("yes")
else:
print("no")
It gives "yes".
I know the correct syntax should be if x==3 or x==4
. However, I can't seem to explain the result yielded from the wrong syntax and have tried checking it out on PythonTutor. Why does it result in "yes"?
Aucun commentaire:
Enregistrer un commentaire