Computers and Technology
Computers and Technology, 21.03.2020 01:57, misssy808

Complete a Python program that uses a list to store data for the village of Marengo. The village of Marengo conducted a census and collected records that contain household data, including the number of occupants in each household. The exact number of household records has not yet been determined, but you know that Marengo has fewer than 300 households.
The program should allow the user to enter each household size and determine the mean and median household size in Marengo. The program should output the mean and median household size in Marengo. 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.

Instructions:
Make sure that the file HouseholdSize. py is selected and open.
Write the bubble sort.
Calculate the total of the household size.
Output the mean and median household size in Marengo.
Execute the program by clicking the "Run Code" button and the bottom of the screen.
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.

"
HouseholdSize. py - This program uses a bubble sort to arrange household sizes in descending order and then prints the mean and median household size.
Input: Interactive.
Output: Mean and median household size.
"

# Initialize variables.
householdSizes = [] # Array used to store household sizes.
numSizes = 0
total = 0.0
mean = 0.0
median = 0

# Input household size
householdSizeString = input("Enter household size or 999 to quit: ")
householdSize = int(householdSizeString)
# This is the work done in the fillArray() function
while (householdSize != 999):
# Place value in array.
householdSizes. append(householdSize)
# Calculate total of household sizes

numSizes += 1 # We have one more house
householdSizeString = input("Enter household size or 999 to quit: ")
householdSize = int(householdSizeString)

# Find the mean
# This is the work done in the sortArray() function
# This is the work done in the displayArray() function
# Find the median

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 23:30, nourmaali
4.11 painting a wall (1) prompt the user to input integers for a wall's height and width. calculate and output the wall's area (integer). note that in this case there is a new line after each prompt. (submit for 1 point). enter wall height (feet): 11 enter wall width (feet): 15 wall area: 165 square feet (2) extend to also calculate and output the amount of paint in gallons needed to paint the wall (floating point). assume a gallon of paint covers 350 square feet. store this value in a variable. output the amount of paint needed using the %f conversion specifier. (submit for 2 points, so 3 points total). enter wall height (feet): 11 enter wall width (feet): 15 wall area: 165 square feet paint needed: 0.471429 gallons (3) extend to also calculate and output the number of 1 gallon cans needed to paint the wall. hint: use a math function to round up to the nearest gallon. (submit for 2 points, so 5 points total). enter wall height (feet): 11 enter wall width (feet): 15 wall area: 165 square feet paint needed: 0.471429 gallons
Answers: 3
image
Computers and Technology, 22.06.2019 11:30, stodd9503
Awell-diversified portfolio needs about 20-25 stocks from different categories is this true or false?
Answers: 2
image
Computers and Technology, 23.06.2019 05:00, mariahchaparro08
Which best explains why a digital leader would join a society specializing in technology
Answers: 1
image
Computers and Technology, 23.06.2019 17:30, Annlee23
When making changes to optimize part of a processor, it is often the case that speeding up one type of instruction comes at the cost of slowing down something else. for example, if we put in a complicated fast floating-point unit, that takes space, and something might have to be moved farther away from the middle to accommodate it, adding an extra cycle in delay to reach that unit. the basic amdahl's law equation does not take into account this trade-off. a. if the new fast floating-point unit speeds up floating-point operations by, on average, 2ă—, and floating-point operations take 20% of the original program's execution time, what is the overall speedup (ignoring the penalty to any other instructions)? b. now assume that speeding up the floating-point unit slowed down data cache accesses, resulting in a 1.5ă— slowdown (or 2/3 speedup). data cache accesses consume 10% of the execution time. what is the overall speedup now? c. after implementing the new floating-point operations, what percentage of execution time is spent on floating-point operations? what percentage is spent on data cache accesses?
Answers: 2
Do you know the correct answer?
Complete a Python program that uses a list to store data for the village of Marengo. The village of...

Questions in other subjects: