Summary
Lists
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
1. Make sure the file
BattingAverage.py is selected and
open.
22 for (loopIndex = 1; loopIndex < SIZE; ++loopIndex);
23
24 if(min > averages[loopIndex])
25 min = averages[loopIndex];
26
27 if(max < averages[loopIndex])
28 max = averages[loopIndex];
29
30 total += averages[loopIndex];
31
32 # Calculate the average of the 8 batting averages.
33 average = total / SIZE
34
35 # Print the batting averages stored in the averages array.
36 for (loopIndex = 0; loopIndex < SIZE; ++loopIndex)
37 print ("Average["<<loopIndex+1<<"] = "<<averages[loopIndex]<<"\n")
38 # Print the maximum batting average, minimum batting average, and average
39 batting average.
40 print ("Maximum batting average: "<<max<<"\n")
41 print ("Minimum batting average: "<<min<<"\n")
42 print ("Average of batting averages: "<<average<<"\n")
File "BattingAverage.py", line 25
for (loopIndex = 1; loopIndex < SIZE;
++loopIndex);
SyntaxError: invalid syntax