+ 2
1 == True
So, for some reason, Python equates True and 1. So this code rewrites 1 from "apples" to False. This made testing the code incredibly confusing. Clearly whoever wrote the code didn't experiment with it or they would have realized they put up some incredibly confusing and misleading code. I hope this at least helps somebody.
2 Respostas
0
In Python 3.x True and False are keywords and will always be equal to 1 and 0.
0
Right. I get that. Which is why it is a poor and confusing example. The example creates a dictionary value for 1, then it it overwrites it by creating a dictionary value for True. I doubt the designer intended to do that, because it is very confusing to a newcomer.