Informatics Practices
Which function is used to return a value for the given key?
- len()
- get()
- keys()
- None of these
Python Dictionaries
1 Like
Answer
get()
Reason — The get() method returns a value for the given key. If key is not available, then returns the default value None.
Answered By
1 Like
Related Questions
Keys of a dictionary must be:
- Similar
- Unique
- Both (i) and (ii)
- All of these
To create a new dictionary with no items:
- Dict
- dict()
- d1={}
- Both 2 and 3
Which function is used to remove all items from a particular dictionary?
- clear()
- pop()
- delete()
- rem()
What will be the output of the following Python code snippet?
d1 = { "amit" :40, "jatin" :45} d2 = { "amit" :466, "jatin" :45} d1 > d2- True
- False
- Error
- None