Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that first creates a dictionary object student into with the following information (ID used as the key; Name used as the value):
Write a program that first creates a dictionary object student into with the following information (ID used as the key; Name used as the value): Student ID Student Name 001 002 003 Alice Bob Charlie Then, perform the following tasks: (1) Add the key-value pairs (004, David) and (001, Alex) into the student_into. (2) Use the del statement to remove the element with key '005. Use in or not in operator to avoid KeyError exception as necessary. (3) Use get method to retrieve and print the value associated with key '001 (4) Use pop method to retrieve and print the value associated with key '003'. Note that this will pop out the key-value pair of key 003 (5) Use items method to return and print all keys and corresponding values. value associated with key 001 is Alex value associated with key 003 is Charlie 001 Alex 002 Bob 004 David
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started