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
icon
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)
 
 
Output
Enter a batting average: .299
Enter a batting average: .157
Enter a batting average: .242
Enter a batting average: .203
Enter a batting average: .198
Enter a batting average: .333
Enter a batting average: .27O
Enter a batting average: .190
The batting averages stored in the array are:
0.299
0.157
0.242
0.203
0.198
0.333
0.27
0.19
The maximum batting average is: 0.333
The minimum batting average is: 0.157
The average of the batting averages is: 0.2365
Results O
Minimum batting average is 0.157 Maximum batting average is 0.333
Average batting average is 0.236
Expected Output ®
Minimum batting average is 0.157 Maximum batting average is 0.333
Average batting average is 0.236
Transcribed Image Text:Output Enter a batting average: .299 Enter a batting average: .157 Enter a batting average: .242 Enter a batting average: .203 Enter a batting average: .198 Enter a batting average: .333 Enter a batting average: .27O Enter a batting average: .190 The batting averages stored in the array are: 0.299 0.157 0.242 0.203 0.198 0.333 0.27 0.19 The maximum batting average is: 0.333 The minimum batting average is: 0.157 The average of the batting averages is: 0.2365 Results O Minimum batting average is 0.157 Maximum batting average is 0.333 Average batting average is 0.236 Expected Output ® Minimum batting average is 0.157 Maximum batting average is 0.333 Average batting average is 0.236
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Array
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.
Similar questions
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education