
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
![Home
B Announcements - IT-140-J61 x
zy Section 6.16 - IT 140: Introdu
* [Solved] 18 LAB: Word freque x
b Answered: CHALLENGE 6.2.1
+
8 https://learn.zybooks.com/zybook/SNHUIT140V3/chapter/6/section/16
= zyBooks My library > IT 140: Introduction to Scripting v3 home > 6.16: Iterating over a dictionary
E zyBooks catalog
? Help/FAQ
8 Jose Roque
CHALLENGE
6.16.1: Report country population.
АCTIVITY
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':
United States has 318463000 people.
India has 1247220000 people.
Indonesia has 252164800 people.
China has 1365830000 people.
247772.2002516.qx3zqy7
1 user_input = input()
2 entries = user_input.split(',')
3 country_pop = {}
1 test
passed
4
5 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' }
6
All tests
7
passed
8
9
10 '' Your solution goes here ''"
11
12
print(country, 'has', pop, 'people.')
12:31 AM
P Type here to search
83°F Mostly cloudy
8/3/2021
近](https://content.bartleby.com/qna-images/question/8d41b3c0-af7d-4e66-af79-e3e907a4c005/498934b4-7766-4ee9-9048-f6a61921f651/h9zvshv_thumbnail.png)
Transcribed Image Text:Home
B Announcements - IT-140-J61 x
zy Section 6.16 - IT 140: Introdu
* [Solved] 18 LAB: Word freque x
b Answered: CHALLENGE 6.2.1
+
8 https://learn.zybooks.com/zybook/SNHUIT140V3/chapter/6/section/16
= zyBooks My library > IT 140: Introduction to Scripting v3 home > 6.16: Iterating over a dictionary
E zyBooks catalog
? Help/FAQ
8 Jose Roque
CHALLENGE
6.16.1: Report country population.
АCTIVITY
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':
United States has 318463000 people.
India has 1247220000 people.
Indonesia has 252164800 people.
China has 1365830000 people.
247772.2002516.qx3zqy7
1 user_input = input()
2 entries = user_input.split(',')
3 country_pop = {}
1 test
passed
4
5 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' }
6
All tests
7
passed
8
9
10 '' Your solution goes here ''"
11
12
print(country, 'has', pop, 'people.')
12:31 AM
P Type here to search
83°F Mostly cloudy
8/3/2021
近
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 2 images

Knowledge Booster
Similar questions
- Write a loop snippet (just a piece of code, not the whole program) that will sum every third element in a 1D array. The size of the array is held in the variable MAX. You will start with the first element in the array. The name of the array is testarray.arrow_forwardtext file 80 1 2 3 100 100 100 1001 0 2 100 3 4 100 1002 2 0 4 4 100 5 1003 100 4 0 100 100 4 100100 3 4 100 0 3 3 3100 4 100 100 3 0 100 1100 100 5 4 3 100 0 2100 100 100 100 3 1 2 0 My code below. I am getting an error when trying to create my adjacency matrix. i dont know what i am doing wrong def readMatrix(inputfilename): ''' Returns a two-dimentional array created from the data in the given file. Pre: 'inputfilename' is the name of a text file whose first row contains the number of vertices in a graph and whose subsequent rows contain the rows of the adjacency matrix of the graph. ''' # Open the file f = open(inputfilename, 'r') # Read the number of vertices from the first line of the file n = int(f.readline().strip()) # Read the rest of the file stripping off the newline characters and splitting it into # a list of intger values rest = f.read().strip().split() # Create the adjacency matrix adjMat = []…arrow_forwardIn Java please! The text file is in the second image.arrow_forward
- Use Java pl DataFileWords.txt: lovegentlensslovepeacelovekindnesslovepeaceunderstandingkindnessjoypeaceunderstandingfriendshipgentlenssgoodnesslovepeacegoodnesslovegentlensscontrolunderstandingunderstandinggentlensslovepeacepatiencecontrolkindnessgentlensslovepeacejoygoodnesspeacefriendshipgoodnesskindnesslovepeacegoodnesscontrolpatiencejoygentlensspatiencegentlensspatiencekindnessgoodnessjoygentlenssgentlenssarrow_forwardIn this project you will generate a poker hand containing five cards randomly selected from a deck of cards. The names of the cards are stored in a text string will be converted into an array. The array will be randomly sorted to "shuffle" the deck. Each time the user clicks a Deal button, the last five cards of the array will be removed, reducing the size of the deck size. When the size of the deck drops to zero, a new randomly sorted deck will be generated. A preview of the completed project with a randomly generated hand is shown in Figure 7-50.arrow_forwardImplement a “To Do” list. Tasks have a priority between 1 and 9, and a description (which you can come up with on your own, say, “wash dishes”). The program is going to prompt the user to enter the tasks by running the method add_priority_description, the program adds a new task and prints the current list with priority 1 tasks on the top, and priority 9 tasks at the bottom. The program will continue to ask the user if they want to add another tasks, and repeat the add_priority_description method, or enters Q to run the quit method to quit the program. Sample output (not limited to) 1. Study for the final 1. Take the final 2. Watch Justice League with friends 3. Play ball 9. Wash Dishes 9. Clean room. There is a possibility of two tasks having the same priority. If so, the last task that was entered gets to be printed first. Use HEAP in your solution.arrow_forward
- Javascript Use a for/of loop to iterate over the array of students. For each student, use a template literal to print out their name, age, and major in a formatted string. (e.g. John is 18 years old and is studying Computer Science.) Within the template literal, use object dot notation to access the name, age, and major properties of the student object. Use a console.log() to print out the formatted string for each student. Test the code by running it and verifying that it prints out the details of each student in a formatted string.============================================================================== const students = [ { name: "John", age: 18, major: "Computer Science" }, { name: "Newton", age: 19, major: "Mathematics" }, { name: "Barry", age: 20, major: "Physics" }, ]; // Iterate through the array of objects students using for/of // Print a message to the console that includes the student's name, age, and major // Example: John is 18 years old and…arrow_forwardWrite a loop to print all elements in hourly_temperature. Separate elements with a -> surrounded by spaces. Sample output for the given program with input: '90 92 94 95' 90 92 -> 94 - 95 Note: 95 is followed by a space, then a newline. Code writing challenge activity demo 461710.3116374.qx3zqy7 1 user_input input() 2 hourly_temperature = user_input.split() 3 41arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY