What will be the output of the following code?
D1 = {‘name’: ‘Alice’, ‘age’: 20, ‘gender’: ‘F’}
D2 = D1.popitem()
print(D1)
print(D2)
-
{‘name’: ‘Alice’, ‘age’: 20} (‘gender’, ‘F’)
-
{‘name’: ‘Alice’, ‘gender’: ‘F’} (‘age’, 20)
-
{‘age’: 20, ‘gender’: ‘F’} (‘name’, ‘Alice’)
-
Error
Answer:
Answer by student
a. {‘name’: ‘Alice’, ‘age’: 20} (‘gender’, ‘F’)
Detailed answer by teachoo
The rest of the post is locked. Join Teachoo Black to see the full post.