Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CHALLENGE 5.19.1: Delete from dictionary. ACTIVITY Delete Prussia from country_capital. Sample output with input: 'Spain: Madrid, Togo:Lome, Prussia:Konigsberg' Prussia deleted? Yes. Spain deleted? No.
CHALLENGE 5.19.1: Delete from dictionary. ACTIVITY Delete Prussia from country_capital. Sample output with input: 'Spain: Madrid, Togo:Lome, Prussia:Konigsberg' Prussia deleted? Yes. Spain deleted? No. Togo deleted? No. Code writing challenge activity demo 461560.1169008.qx3zqy7 1 user_input input () 2 entries = 3 country_capital {} 4 5 for pair in entries: 6 split_pair = 7 8 AWNH O O 00 user_input.split(',') country_capital[split_pair[0]] = split_pair[1] #country_capital is a dictionary, Ex. { 'Germany': 'Berlin', 'France': 'Paris' Your solution goes here 11 12 print ('Prussia deleted?', end=' ') 9 10 pair.split(':') 13 if 'Prussia' in country_capital: 14 print('No.') 15 else: 16 print('Yes.') 17 18 print ('Spain deleted?'. end='') 1 tes passe All tes passe
Step by Step Solution
There are 3 Steps involved in it
Step: 1
To delete the entry for Prussia from the countrycapital dictionary and display the appropriate outpu...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