Question: The given template code will build a dictionary, card_dict, and a list, person_list. The keys for card_dict are names and the values are trading cards.

 The given template code will build a dictionary, card_dict, and alist, person_list. The keys for card_dict are names and the values aretrading cards. The values for person_list are the same names as thekeys for card_dict. All keys and values are strings. Do NOT change

The given template code will build a dictionary, card_dict, and a list, person_list. The keys for card_dict are names and the values are trading cards. The values for person_list are the same names as the keys for card_dict. All keys and values are strings. Do NOT change the template code. Do NOT try to hard code output. Below the template, write code to do the following: Part 1 Print "Part 1" Print card_dict Print person_list Input a name for person 1 (string). Input a name for person 2 (string). If the names are the same, print "Same person. No swap." Otherwise, if person 1 is not equal to "Oz", using the two input names as keys for card_dict, swap their values. Print card_dict Part 2 Print "Part 2" Remove person 1 from person_list (l.e., the name will be in person_list, and you should delete this). Remove person 2 from card_dict (1.e., person_2 is a key). Print card_dict Print person_list 0 1 #Do NOT change the code below. 2 # Begin student code where indicated below. 3 4 card_dict } 5 person_list = [] 6 in_name = input() 7 while in_name != "end": 8 in_card = input() card_dict[in_name] = in_card 10 person_list.append(in_name) 11 in_name = input() 12 13 #Do not change anything above this line or write any student code above this line. 14 # After the code above executes, you will have test_dict as described in the instructions. 15 9 16 # *** Student code goes next. You may keep or delete anything that is below. *** 17 print("Part 1") 18 print(card_dict) 19 print(person_list) 20 21 22 23

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!