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
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
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...](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Ff754e220-427d-4413-9e56-39a756e77625%2Fdc1c8922-5758-44f2-9a1f-d9653719bc0b%2Fg85dl8u_processed.png&w=3840&q=75)
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...

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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images

Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
Looking for the code explanation

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
Knowledge Booster
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.Recommended textbooks for you

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education