Home »
Python »
Python Dictionary MCQs
What will be the output of the following code? | Dictionary Que. 13
13. What will be the output of the following code?
D={1:7,2:"everyone"}
print(D[2])
- 7
- 1
- 2
- everyone
Answer: D) everyone
Explanation:
Whenever you will write an index it will start from 1 and according to the index provided it will provide you the respected pair value. For example, in the above code, D[2] states the index 2 which means it will give you the pair value of the second key.