Bubble Sort HouseholdSize.py 2 HouseholdSize.py - This program uses a bubble sort to arrange household size in descending order and then prints the mean and median Summary 3 4 household size. In this lab, you will complete a Python program that uses a list to store data for the village of 5 Input: Interactive. Marengo. 6 Output: Mean and median household size. 8 The village of Marengo conducted a census and collected records that contain household 9 # Initialize variables. data, including the number of occupants in each household. The exact number of household 10 householdSizes = [] # Array used to store household sizes. 11 numSizes = 0 12 total = 0.0 records has not yet been determined, but you know that Marengo has fewer than 300 households. 13 mean = 0.0 The program is described in Chapter 8, Exercise 5, in Programming Logic and Design. The 14 median = 0.0 15 program should allow the user to enter each household size and determine the mean and 16 # Input household size 17 householdSizeString = input("Enter household size or 999 to quit: ") |18 householdSize = int(householdSizeString) 19 # This is the work done in the fillArray() function 20 while (householdSize != 999): 21 22 23 24 median household size in Marengo. The program should output the mean and median household size in Marengo. The file provided for this lab contains the necessary variable declarations and input statements. You need to write the code that sorts the household sizes in ascending order using a bubble sort, and then prints the mean and median household size in Marengo. Comments in the code tell you where to write your statements. # Place value in array. householdSizes.append(householdSize) # Calculate total of household sizes Instructions 25 numSizes += 1 # We have more house householdSizeString = input("Enter household size or 999 to quit: ") householdSize = int(householdSizeString) 1. Make sure that the file HouseholdSize.py is selected and open. 26 27 28 29 # Find the mean 30 31 # This is the work done in the sortArray() function 32 33 # This is the work done in the displayArray() function 34 35 # Find the median 36 2. Write the bubble sort. 3. Calculate the total of the household size. 4. Output the mean and median household size in Marengo. 5. Execute the program by clicking the Run button and the bottom of the screen. 6. Enter the following input, and ensure the output is correct. Household sizes: 4, 1, 2, 4, 3, 3, 2. 2, 2, 4, 5, 6 followed by 999 to exit the program.
Bubble Sort HouseholdSize.py 2 HouseholdSize.py - This program uses a bubble sort to arrange household size in descending order and then prints the mean and median Summary 3 4 household size. In this lab, you will complete a Python program that uses a list to store data for the village of 5 Input: Interactive. Marengo. 6 Output: Mean and median household size. 8 The village of Marengo conducted a census and collected records that contain household 9 # Initialize variables. data, including the number of occupants in each household. The exact number of household 10 householdSizes = [] # Array used to store household sizes. 11 numSizes = 0 12 total = 0.0 records has not yet been determined, but you know that Marengo has fewer than 300 households. 13 mean = 0.0 The program is described in Chapter 8, Exercise 5, in Programming Logic and Design. The 14 median = 0.0 15 program should allow the user to enter each household size and determine the mean and 16 # Input household size 17 householdSizeString = input("Enter household size or 999 to quit: ") |18 householdSize = int(householdSizeString) 19 # This is the work done in the fillArray() function 20 while (householdSize != 999): 21 22 23 24 median household size in Marengo. The program should output the mean and median household size in Marengo. The file provided for this lab contains the necessary variable declarations and input statements. You need to write the code that sorts the household sizes in ascending order using a bubble sort, and then prints the mean and median household size in Marengo. Comments in the code tell you where to write your statements. # Place value in array. householdSizes.append(householdSize) # Calculate total of household sizes Instructions 25 numSizes += 1 # We have more house householdSizeString = input("Enter household size or 999 to quit: ") householdSize = int(householdSizeString) 1. Make sure that the file HouseholdSize.py is selected and open. 26 27 28 29 # Find the mean 30 31 # This is the work done in the sortArray() function 32 33 # This is the work done in the displayArray() function 34 35 # Find the median 36 2. Write the bubble sort. 3. Calculate the total of the household size. 4. Output the mean and median household size in Marengo. 5. Execute the program by clicking the Run button and the bottom of the screen. 6. Enter the following input, and ensure the output is correct. Household sizes: 4, 1, 2, 4, 3, 3, 2. 2, 2, 4, 5, 6 followed by 999 to exit the program.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
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 now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
Recommended textbooks for you
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
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