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])
  1. 7
  2. 1
  3. 2
  4. 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.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.