Home Physics What is the total and average of 4, 6, 8, 5, 7? What is the total and average of 4, 6, 8, 5, 7?Physics mobeteOctober 23, 20214 CommentsWhat is the total and average of 4, 6, 8, 5, 7?
See explainationExplanation:# Declare a named constant for array size here.MAX_AVERAGES = 8# Declare array here.averages = []# Write a loop to get batting averages from user and assign to array.for i in range(MAX_AVERAGES): averageString = input("Enter a batting average: ") battingAverage = float(averageString) # Assign value to array. averages.append(battingAverage)# 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.for i in range(1, MAX_AVERAGES): if averages[i] < minAverage: minAverage = averages[i] if averages[i] > maxAverage: maxAverage = averages[i] total += averages[i]# Also accumulate a total of all batting averages.# Calculate the average of the 8 batting averages.average = total / MAX_AVERAGES# Print the batting averages stored in the averages array.for avg in averages: print(avg)# Print the maximum batting average, minimum batting average, and average batting average.print('Maximum batting average is ' + str(maxAverage))print('Minimum batting average is ' + str(minAverage))print('Average batting average is ' + str(average)Reply
Their total is 30.Since there are 5 of them, their average is 1/5 of their total = 6 .Their total is the same as it would be if every number were 6 . That's what 'average' and 'mean' mean.Reply
See explaination
Explanation:
# Declare a named constant for array size here.
MAX_AVERAGES = 8
# Declare array here.
averages = []
# Write a loop to get batting averages from user and assign to array.
for i in range(MAX_AVERAGES):
averageString = input("Enter a batting average: ")
battingAverage = float(averageString)
# Assign value to array.
averages.append(battingAverage)
# 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.
for i in range(1, MAX_AVERAGES):
if averages[i] < minAverage:
minAverage = averages[i]
if averages[i] > maxAverage:
maxAverage = averages[i]
total += averages[i]
# Also accumulate a total of all batting averages.
# Calculate the average of the 8 batting averages.
average = total / MAX_AVERAGES
# Print the batting averages stored in the averages array.
for avg in averages:
print(avg)
# Print the maximum batting average, minimum batting average, and average batting average.
print('Maximum batting average is ' + str(maxAverage))
print('Minimum batting average is ' + str(minAverage))
print('Average batting average is ' + str(average)
250✖️100 to get you answer
Their total is 30.
Since there are 5 of them, their average is 1/5 of their total = 6 .
Their total is the same as it would be if every number were 6 . That's what 'average' and 'mean' mean.
British cologoinst admisitrion