Answered step by step
Verified Expert Solution
Link Copied!

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.

image

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Systems analysis and design

Authors: kenneth e. kendall, julie e. kendall

8th Edition

135094909, 013608916X, 9780135094907, 978-0136089162

More Books

Students also viewed these Programming questions

Question

Differentiate. y = ln(3x + 1) ln(5x + 1)

Answered: 1 week ago