Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a loop that prints each country's population in country_pop Sample output with input: China 1365830000,India:1247220000,United States 318463000, Indonesia 252164800 China has 1365830000 people.
Write a loop that prints each country's population in country_pop Sample output with input: China 1365830000,India:1247220000,United States 318463000, Indonesia 252164800 China has 1365830000 people. India has 1247220000 people. United States has 318463000 people. Indonesia has 252164800 people. Code writing challenge activity demo 404 7554py? 1 user_input = input() 2 entries - user_input.split(',') 3 country pop -{} 4 5 6 7 8 9 for pair in entries: split pair pair.split(':') country pop split pair[0]] split_pair[1] #country_pop is a dictionary, Ex: { 'Germany': '82790000', 'France': '67190000"} 10 for a country, pop in country_pop.itemsO: 11 12 print(f' (country) has (pop) people.")
Step by Step Solution
There are 3 Steps involved in it
Step: 1
python userinput inputEnter country populations in the form...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