Informatics Practices
Which function is used to remove all items from a particular dictionary?
- clear()
- pop()
- delete()
- rem()
Python Dictionaries
2 Likes
Answer
clear()
Reason — The clear() function is used to remove all items from the particular dictionary and returns an empty dictionary.
Answered By
2 Likes
Related Questions
To create a new dictionary with no items:
- Dict
- dict()
- d1={}
- Both 2 and 3
Which function is used to return a value for the given key?
- len()
- get()
- keys()
- None of these
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
Which of the following functions will return key-value pairs of the dictionary in the form of list of tuples?
- key()
- values()
- items()
- get()