2 MAX_AVERAGES = 8 Summary 3 4 # Declare array here. In this lab, you complete a partially prewritten Python 5 program that uses a list. 6 # Write a loop to get batting averages from user and assign to array. 7 averageString = input("Enter a batting average: ") battingAverage = float(averageString) # Assign value to array. 8 The program prompts the user to interactively enter eight 9 batting averages, which the program stores in an array. It 10 should then find the minimum and maximum batting 11 averages stored in the array, as well as the average of the 12 # Assign the first element in the array to be the minimum and the maxim 13 minAverage = averages[Ø] 14 maxAverage = averages[0] 15 # Start out your total with the value of the first element in the array 16 total = averages[®] 17 # Write a loop here to access array values starting with averages[1] 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. 18 Instructions 19 # Within the loop test for minimum and maximum batting averages. 20 21 1. Make sure the file BattingAverage.py is selected and 22 open. 23 2. Write the Python statements as indicated by the 24 # Also accumulate a total of all batting averages. 25 comments. 26 27 # Calculate the average of the 8 batting averages. 3. Execute the program by clicking the Run button at 28 the bottom of the screen. Enter the following batting 29 averages: .299, .157, .242, .203, .198, .333, .27O, .190. 30 # Print the batting averages stored in the averages array. 31 The minimum batting average should be .157 and the 32 maximum batting average should be .333. The 33 # Print the maximum batting average, minimum batting average, and avera average should be .2365. average. 34

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Declare a named constant for array size nere.
2 MAX_AVERAGES = 8
Summary
4 # Declare array here.
In this lab, you complete a partially prewritten Python
5
program that uses a list.
6 # Write a loop to get batting averages from user and assign to array.
7
averageString = input("Enter a batting average: ")
battingAverage = float(averageString)
The program prompts the user to interactively enter eight
batting averages, which the program stores in an array. It
10
# Assign value to array.
should then find the minimum and maximum batting
11
averages stored in the array, as well as the average of the
12 # Assign the first element in the array to be the minimum and the maximu
13 minAverage = averages[0]
eight batting averages. The data file provided for this lab
includes the input statement and some variable
14 maxAverage = averages[0]
15 # Start out your total with the value of the first element in the array.
16 total = averages[0]
17 # Write a loop here to access array values starting with averages[1]
declarations. Comments are included in the file to help
you write the remainder of the program.
18
Instructions
19
# Within the loop test for minimum and maximum batting averages.
20
21
1. Make sure the file BattingAverage.py is selected and
22
open.
23
2. Write the Python statements as indicated by the
24
# Also accumulate a total of all batting averages.
25
comments.
26
27 # Calculate the average of the 8 batting averages.
3. Execute the program by clicking the Run button at
28
the bottom of the screen. Enter the following batting
29
averages: .299, .157, .242, .203, .198, .333, .270, .190.
30 # Print the batting averages stored in the averages array.
31
The minimum batting average should be .157 and the
32
maximum batting average should be .333. The
33 # Print the maximum batting average, minimum batting average, and averag
average should be .2365.
average.
34
Transcribed Image Text:Declare a named constant for array size nere. 2 MAX_AVERAGES = 8 Summary 4 # Declare array here. In this lab, you complete a partially prewritten Python 5 program that uses a list. 6 # Write a loop to get batting averages from user and assign to array. 7 averageString = input("Enter a batting average: ") battingAverage = float(averageString) The program prompts the user to interactively enter eight batting averages, which the program stores in an array. It 10 # Assign value to array. should then find the minimum and maximum batting 11 averages stored in the array, as well as the average of the 12 # Assign the first element in the array to be the minimum and the maximu 13 minAverage = averages[0] eight batting averages. The data file provided for this lab includes the input statement and some variable 14 maxAverage = averages[0] 15 # Start out your total with the value of the first element in the array. 16 total = averages[0] 17 # Write a loop here to access array values starting with averages[1] declarations. Comments are included in the file to help you write the remainder of the program. 18 Instructions 19 # Within the loop test for minimum and maximum batting averages. 20 21 1. Make sure the file BattingAverage.py is selected and 22 open. 23 2. Write the Python statements as indicated by the 24 # Also accumulate a total of all batting averages. 25 comments. 26 27 # Calculate the average of the 8 batting averages. 3. Execute the program by clicking the Run button at 28 the bottom of the screen. Enter the following batting 29 averages: .299, .157, .242, .203, .198, .333, .270, .190. 30 # Print the batting averages stored in the averages array. 31 The minimum batting average should be .157 and the 32 maximum batting average should be .333. The 33 # Print the maximum batting average, minimum batting average, and averag average should be .2365. average. 34
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY