The below pthyon code is not passing the code test. Please help idientify what is casuing the error. Image of error in python checker is attached. MAX_AVERAGES = 8 averages = [] for i in range(0, MAX_AVERAGES): averageString = input("Enter a batting average: ") battingAverage = float(averageString) 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] for i in range(1, MAX_AVERAGES): # Within the loop test for minimum and maximum batting averages. if averages[i] < minAverage: minAverage = averages[i] if averages[i] > maxAverage: maxAverage = averages[i] # Also accumulate a total of all batting averages. total = total + averages[i] # Calculate the average of the 8 batting averages. average = total / MAX_AVERAGES # Print the batting averages stored in the averages array. print("The batting averages stored in the array are:") for i in range(0, MAX_AVERAGES): print(averages[i]) # Print the maximum batting average, minimum batting average, and average batting average. print("The maximum batting average is:", maxAverage) print("The minimum batting average is:", minAverage) print("The average of the batting averages is:", average)
The below pthyon code is not passing the code test. Please help idientify what is casuing the error. Image of error in python checker is attached. MAX_AVERAGES = 8 averages = [] for i in range(0, MAX_AVERAGES): averageString = input("Enter a batting average: ") battingAverage = float(averageString) 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] for i in range(1, MAX_AVERAGES): # Within the loop test for minimum and maximum batting averages. if averages[i] < minAverage: minAverage = averages[i] if averages[i] > maxAverage: maxAverage = averages[i] # Also accumulate a total of all batting averages. total = total + averages[i] # Calculate the average of the 8 batting averages. average = total / MAX_AVERAGES # Print the batting averages stored in the averages array. print("The batting averages stored in the array are:") for i in range(0, MAX_AVERAGES): print(averages[i]) # Print the maximum batting average, minimum batting average, and average batting average. print("The maximum batting average is:", maxAverage) print("The minimum batting average is:", minAverage) print("The average of the batting averages is:", average)
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
The below pthyon code is not passing the code test. Please help idientify what is casuing the error. Image of error in python checker is attached.
MAX_AVERAGES = 8
averages = []
for i in range(0, MAX_AVERAGES):
averageString = input("Enter a batting average: ")
battingAverage = float(averageString)
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]
for i in range(1, MAX_AVERAGES):
# Within the loop test for minimum and maximum batting averages.
if averages[i] < minAverage:
minAverage = averages[i]
if averages[i] > maxAverage:
maxAverage = averages[i]
# Also accumulate a total of all batting averages.
total = total + averages[i]
# Calculate the average of the 8 batting averages.
average = total / MAX_AVERAGES
# Print the batting averages stored in the averages array.
print("The batting averages stored in the array are:")
for i in range(0, MAX_AVERAGES):
print(averages[i])
# Print the maximum batting average, minimum batting average, and average batting average.
print("The maximum batting average is:", maxAverage)
print("The minimum batting average is:", minAverage)
print("The average of the batting averages is:", average)
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 4 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education