Choose a topic to test your knowledge and improve your Python skills
Anshu created two dictionaries “D1” and “D2” in python. Later on she wants to add all the elements of D2 in D1. As a friend of Anshu, help her to write the code.
Dhriti wants to create a dictionary with “Jan”, “Feb”, “Mar” as key and 31, 28, 31 as values respectively. Help her to write the correct code.
Write the output of the following: D={1: ['Amit',23,21], 2: ['Suman',45,34], 3: 'Ravi', 4: 'Anuj'} print("Amit" in D)
Which operator is used to check if the key is present in the dictionary or not?
Write the output of the following: D={1: ['Amit',23,21], 2: ['Suman',45,34], 3: 'Ravi', 4: 'Anuj'} m = D.get(2) print(m[2])
Parth wants to display the value corresponding to the key “3” in dictionary given below. As a friend of Parth, help him to find the correct code.D={1: ‘Amit’, 2: ‘Suman’, 3: ‘Ravi’, 4: ‘Anuj’}
Write the output of the following : D={1: 'Amit', 2: 'Suman', 3: 'Ravi', 4: 'Anuj'} print(tuple(D))