CBSE Class 12 Computer Science
Question 90 of 105
Python Revision Tour II — Question 17
Back to all questionsdict_items([('name', 'Aman'), ('age', 27), ('address', 'Delhi')])
A dictionary my_dict with two key-value pairs, 'name': 'Aman' and 'age': 26 is initialized. Then updates the value associated with the key 'age' to 27. Then adds a new key-value pair 'address': 'Delhi' to the dictionary my_dict. The items() method returns all of the items in the dictionary as a sequence of (key, value) tuples. In this case, it will print [('name', 'Aman'), ('age', 27), ('address', 'Delhi')].