0
dictonaries thing
pairs = {1: "apple", "orange": [2, 3, 4], True: "question", None: "True", } print(pairs.get(1)) why output is: question #not an 'apple'????
3 Answers
+ 2
ok, i got it. key '1' and key 'True' - same key and program output last key.
0
print(pairs.get(0))
>>>
None
>>>
if it was an array result print(pairs.get(1)) will be:
[2, 3, 4]
- 1
array index starts from 0. to get apple, print(pairs.get(0));