subject

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.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:20
Write a program that reads a file consisting of students’ test scores in the range 0–200. it should then determine the number of students having scores in each of the following ranges: 0–24, 25–49, 50–74, 75–99, 100–124, 125–149, 150–174, and 175–200. output the score ranges and the number of students. (run your program with the following input data: 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189.)
Answers: 3
question
Computers and Technology, 24.06.2019 02:30
Which option completes the explanation for conflict of interest in an organization
Answers: 1
question
Computers and Technology, 24.06.2019 12:00
An npn transistor is correctly biased and turned on if the a. base is negative. b. collector is negative. c. collector is positive with respect to the emitter and negative with respect to the base. d. collector is the most positive lead followed by the base.
Answers: 1
question
Computers and Technology, 25.06.2019 04:30
You can fit more raw files on a memory card than the jpeg files? truefalse
Answers: 1
You know the right answer?
In this lab, you complete a partially prewritten Python program that uses a list.

The pr...
Questions
question
Mathematics, 08.06.2021 06:40
question
Mathematics, 08.06.2021 06:40
question
Mathematics, 08.06.2021 06:50
Questions on the website: 13722363