Statistics are often calculated with varying amounts of input data. Write a program that takes any number of integers as input, and outputs the average and max. Ex: If the input is: 15 20 0 5 the output is: 10 20

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

Python

Statistics are often calculated with varying amounts of input data. Write a program that takes any number of integers as input, and outputs the average and max.

Ex: If the input is:

15 20 0 5

the output is:

10 20

 

6.12 LAB: Varied amount of input data
Statistics are often calculated with varying amounts of input data. Write a program that takes any number of integers as input, and outputs
the average and max.
Ex: If the input is:
15 20 0 5
the output is:
10 20
440292.2711150.qx3zqy7
LAB
ACTIVITY
6.12.1: LAB: Varied amount of input data
1 # Main.py
2 def main():
3# Empty list to store the user values
4
1st=[]
5 # Read user values separated by space
6
data=input()
7 # Call split to separate the data by space
8
nums-data.split(' ')
9# Loop to insert the integer values into list
for i in nums:
10
11
12 # Call sum function to get in list
13
total sum(1st)
14 # Call average
15
average=total/len(1st)
1st.append(int(i))
main.py
0/10
Load default template...
Transcribed Image Text:6.12 LAB: Varied amount of input data Statistics are often calculated with varying amounts of input data. Write a program that takes any number of integers as input, and outputs the average and max. Ex: If the input is: 15 20 0 5 the output is: 10 20 440292.2711150.qx3zqy7 LAB ACTIVITY 6.12.1: LAB: Varied amount of input data 1 # Main.py 2 def main(): 3# Empty list to store the user values 4 1st=[] 5 # Read user values separated by space 6 data=input() 7 # Call split to separate the data by space 8 nums-data.split(' ') 9# Loop to insert the integer values into list for i in nums: 10 11 12 # Call sum function to get in list 13 total sum(1st) 14 # Call average 15 average=total/len(1st) 1st.append(int(i)) main.py 0/10 Load default template...
Output differs. See highlights below. Special character legend
Your output
Input 15 20 0 5
Expected output
2:Compare output
Output differs. See highlights below.
Your output
3:Compare output
10.0 20
10 20
Input 2 2 2 2 12 0 8 4
Expected output 4 12
Your output
4.0 12
Expected output
Output differs. See highlights below. Special character legend
Input 5
Special character legend
5.0 5
5 5
0/3
0/2
Transcribed Image Text:Output differs. See highlights below. Special character legend Your output Input 15 20 0 5 Expected output 2:Compare output Output differs. See highlights below. Your output 3:Compare output 10.0 20 10 20 Input 2 2 2 2 12 0 8 4 Expected output 4 12 Your output 4.0 12 Expected output Output differs. See highlights below. Special character legend Input 5 Special character legend 5.0 5 5 5 0/3 0/2
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Looking for the code explanation 

Output differs. See highlights below. Special character legend
Your output
Input 15 20 0 5
Expected output
2:Compare output
Output differs. See highlights below.
Your output
3:Compare output
10.0 20
10 20
Input 2 2 2 2 12 0 8 4
Expected output 4 12
Your output
4.0 12
Expected output
Output differs. See highlights below. Special character legend
Input 5
Special character legend
5.0 5
5 5
0/3
0/2
Transcribed Image Text:Output differs. See highlights below. Special character legend Your output Input 15 20 0 5 Expected output 2:Compare output Output differs. See highlights below. Your output 3:Compare output 10.0 20 10 20 Input 2 2 2 2 12 0 8 4 Expected output 4 12 Your output 4.0 12 Expected output Output differs. See highlights below. Special character legend Input 5 Special character legend 5.0 5 5 5 0/3 0/2
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Random Class and its operations
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
  • SEE MORE 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