+ 1
Python
#I got this from trying some variations: test_dictionary01 = { 1: "apple", True: "pear", } print(test_dictionary01.get(1)) print(test_dictionary01.get(True)) test_dictionary02 = { 1: "apple", "True": "pear", } print(test_dictionary02.get(1)) print(test_dictionary02.get(True)) test_dictionary03 = { 1: "apple", "True": "pear", } print(test_dictionary03.get(1)) print(test_dictionary03.get("True")) #.how the output is misbehaving I am unable to understand đ
3 Answers
+ 1
True is a reserved word in Python. Don't use it for variables or keys.
Only the last one is ok, because there it is a string.
Otherwise True is the same as 1
That's also why in your second dict it only prints apple, since the string "True" is not called in any statement.
+ 1
got it thanks bro đ
r u on discord as I wanted help for some screenshots of code if u have time..
0
I am on discord, yes, but only from time to time. I only use it on PC and don't know when I can login again đ¶



