
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
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...](https://content.bartleby.com/qna-images/question/f754e220-427d-4413-9e56-39a756e77625/dc1c8922-5758-44f2-9a1f-d9653719bc0b/g85dl8u_thumbnail.png)
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 nowThis is a popular solution!
Step by stepSolved 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
by Bartleby Expert
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
by Bartleby Expert
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.Similar questions
- Starting out with python fourth edition Tony Gaddis. I know I sent this one, but the problem was incorrect. It is a programming exercise, I am sorry if I did not make that clear. It is Chapter 5 programming exercise problem 12. Maximum of two Numbers.arrow_forwardpythonarrow_forwardpython onlystart from here: def ask_for_age(): age = int(input('Enter the age of a family member: ')) return agearrow_forward
- pythonarrow_forwardOn Thursday, November 4, 2021, Big Man Games wrote: Computer programs are great at computing mathematical formulas. Once the formula is properly encoded you can use the code as much as you want without reprogramming it and you can share it with non-programmers without any trouble. This lab is an example of such a formula. Once you program it you won’t have to worry about the area of a circle again. Write and test a program that computes the area of a circle. This program should request a number representing a radius as input from the user. Use the formula 3.14 × radius2 to compute the area. Tip: There are a couple of ways to code an exponent. Look in the Operators unit for help (and you can’t use an x for multiplication). Tip: You will need to use the float data type to compute the remainder. The output should explain the results. Don’t just print a number. Tip: For your print statement you will need to use the comma, “,”, or plus, “+” symbols to stitch your output together. (“The…arrow_forwardUsing introduction to Python You have been asked to write an application that automatically grades a quiz. The quiz has 15 multiple-choice questions. The correct answers are: 1.A, 2.C, 3.A, 4.B, 5.B, 6.D, 7.D, 8.A, 9.C, 10.A, 11.B, 12.C, 13.D, 14.C, 15.B The program will start by creating a list holding the quiz answers key shown above. It will then prompt the user for the student name and their answers file and read them into a separate list. It will finally compare the key vs. answers lists to calculate & display: Number of correct answersNumber of incorrect answersQuestions incorrectly answered.Whether the student has passed or failed the quizA student must correctly answer 11 out of 15 questions to pass.The user can grade as many students as they wish. Notes The file containing the student’s answers is organized as 15 lines. Each line contains the answer to the corresponding question. The responses are single character strings, from A to D, uppercase. Must use functional…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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