Home »
Python »
Python Dictionary MCQs
How do you use the get() function to access the pair values?
15. How do you use the get() function to access the pair values?
- D={1:7,2:"everyone"}
print(D.get(2))
- D={1:7,2:"everyone"}
print(D=get(2))
- D={1:7,2:"everyone"}
print(get(2))
Answer: A) D={1:7,2:"everyone"}
print(D.get(2))
Explanation:
The correct syntax to use the get() function is:
D = {1:7,2:"everyone"}
print(D.get(2))