CBSE Class 11 Informatics Practices
Question 41 of 66
Dictionary — Question 13
Back to all questionsdict_items([(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')])
dict_keys([1, 2, 3, 4])
dict_values(['one', 'two', 'three', 'four'])
6
d1.items()— Returns a list of tuples containing the key-value pairs ind1.d1.keys()— Returns a list of all the keys ind1.d1.values()— Returns a list of all the values ind1.d1.update(d2)— Updatesd1with key-value pairs fromd2. After this operation,d1contains {1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six'}.len(d1)— Returns the number of key-value pairs ind1, which is 6 after updating.