Computers and Technology

In this lab, you complete a partially prewritten Python program that uses a list.

The program prompts the user to interactively enter eight batting averages, which the program stores in an array. It should then find the minimum and maximum batting averages stored in the array, as well as the average of the eight batting averages. The data file provided for this lab includes the input statement and some variable declarations. Comments are included in the file to help you write the remainder of the program.

Instructions

Make sure the file BattingAverage. py is selected and open.

Write the Python statements as indicated by the comments.

Execute the program by clicking the "Run Code" button at the bottom of the screen. Enter the following batting averages: .299, .157, .242, .203, .198, .333, .270, .190. The minimum batting average should be .157 and the maximum batting average should be .333. The average should be .2365.

# Declare a named constant for array size here.
MAX_AVERAGES = 8

# Declare array here.

# Write a loop to get batting averages from user and assign to array.

averageString = input("Enter a batting average: ")
battingAverage = float(averageString)
# Assign value to array.

# Assign the first element in the array to be the minimum and the maximum.
minAverage = averages[0]
maxAverage = averages[0]
# Start out your total with the value of the first element in the array.
total = averages[0]
# Write a loop here to access array values starting with averages[1]

# Within the loop test for minimum and maximum batting averages.

# Also accumulate a total of all batting averages.

# Calculate the average of the 8 batting averages.

# Print the batting averages stored in the averages array.

# Print the maximum batting average, minimum batting average, and average batting average.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 01:20, shiann2002
Me with this program in c++ ! computers represent color by combining sub-colors red, green, and blue (rgb). each sub-color's value can range from 0 to 255. thus (255, 0, 0) is bright red. (130, 0, 130) is a medium purple. (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (in other word, equal amounts of red, green, blue yield gray).given values for red, green, and blue, remove the gray part. ex: if the input is 130 50 130, the output is: 80 0 80. thus, find the smallest value, and then subtract it from all three values, thus removing the gray.
Answers: 3
image
Computers and Technology, 23.06.2019 11:30, kieante01
The most accurate readings that you can take on an analog vom are when the meter's pointer is at the a. center scale. b. extreme right. c. near right. d. extreme left.
Answers: 1
image
Computers and Technology, 23.06.2019 13:50, mrfishyyyy
Explain how email technologies enable the exchange of messages between users. find out the typical parts of an email address and explain each part.
Answers: 1
image
Computers and Technology, 23.06.2019 14:00, savannnab1890
Select the correct answer. andre was recently hired by an organization to check for system vulnerabilities. he is supposed to exploit these vulnerabilities and create a report on the extent of damage to which the system was susceptible. what position does andre hold in this organization? a. information security analyst b. information assurance manager c. penetration tester d. network security engineer e. chief information security officer
Answers: 2
Do you know the correct answer?
In this lab, you complete a partially prewritten Python program that uses a list.

The pr...

Questions in other subjects:

Konu
Mathematics, 26.07.2019 01:40