Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

Show the code for a python program that 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.
  2. Write the Python statements as indicated by the comments.
  3. Execute the program by clicking the Run button at the bottom of the screen. Enter the following batting averages: .299.157.242.203.198.333.270.190. The minimum batting average should be .157 and the maximum batting average should be .333. The average should be .2365.

 

# Declare a named constant for array size here.
MAX_AVERAGES = 8

# Declare array here.

# Write a loop to get batting averages from user and assign to array.

    averageString = input("Enter a batting average: ")
    battingAverage = float(averageString)
    # Assign value to array.

# 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.




    # Also accumulate a total of all batting averages.


# Calculate the average of the 8 batting averages.


# Print the batting averages stored in the averages array.


# Print the maximum batting average, minimum batting average, and average batting average.
Expert Solution
Check Mark
Still need help?
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Python is showing the code as incomplete when running test program.

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
expand button
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
Solution
Bartleby Expert
by Bartleby Expert
SEE SOLUTION
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Python is showing the code as incomplete when running test program.

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
expand button
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
Solution
Bartleby Expert
by Bartleby Expert
SEE SOLUTION
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education