0

why 1: False in output?

pairs = {1: "apple", "orange": [2, 3, 4], True: False, None: "True", } print(pairs.get("orange")) print(pairs.get(7)) print(pairs.get(12345, "not in dictionary")) pairs [2]=55 print (pairs) output: [2,3,4] None not in dictionary {1:False , 'orange': [2, 3, 4], True: False, None: 'True',2:55}

30th Aug 2017, 1:06 PM
Masroor Javadi
Masroor Javadi - avatar
4 Respuestas
+ 4
Look in the comments; it helped me here and I think it'll help you too. ;)
30th Aug 2017, 2:20 PM
J.G.
J.G. - avatar
+ 1
IN PYTHON THIS THINGS ARE BY DEFAULT.. 1 MEANS TRUE 0 MEANS FALSE suppose...u doing pairs={1 : "yoo" , 0 : "solo" ,True : "hi" , False : "bye"} print(pairs) { 1 : "hi" , 0 : "bye" } taking last values initialised in 1 and 0 as 1 is true and 0 is false initialising in true and false means reinitialising in 1 and 0
30th Aug 2017, 2:44 PM
sayan chandra
sayan chandra - avatar
+ 1
### another proof that 1 is True and 0 is False#### try this code ############### pairs={1 : "qwerty" , 0 : "solo"} print(pairs.get(True)) print(pairs.get(False)) ############### output---> qwerty solo
30th Aug 2017, 2:56 PM
sayan chandra
sayan chandra - avatar
0
thank you so much👌👌👌
30th Aug 2017, 4:32 PM
Masroor Javadi
Masroor Javadi - avatar