0
Why is the output of this code "false".i thought it would be "apples" rather
pairs = {1: "apple", "orange": [2, 3, 4], True: False, None: "True", } print(pairs.get(1))
6 Réponses
+ 2
True is automatically converted to 1. So the value mapped to 1 literally is False as
True: False
But, True = 1
=> 1: False
So .get(1) gives False
+ 1
In programming True = 1 and False = 0. It probably saw 1 as True
+ 1
Thanks guys
0
So in that case..it was supposed to print "true" right?..but it printed "false"
0
Oh
0
Okay..that makes sense