● Create a Python file called amazon.py in this folder. ● Write code to read the content of the text file input.txt. ● For each line in input.txt, write a new line in the new text file output.txt that computes the answer to some operation on a list of numbers. ● If the input.txt has the following: o Min: 1,2,3,5,6 o Max: 1,2,3,5,6 o Avg: 1,2,3,5,6 ● Your program should generate output.txt as follows: o The min of [1, 2, 3, 5, 6] is 1. o The max of [1, 2, 3, 5, 6] is 6. o The avg of [1, 2, 3, 5, 6] is 3.4. ● Assume that the only operations given in the input file are min, max and avg, and that the operation is always followed by a list of comma-separated integers. ● You should define the functions min, max and avg that take in a list of integers and return the min, max or avg of the list. ● Your program should handle any combination of operations and any length of input numbers. ● You can assume that the list of input numbers are always valid integers and that the list is never empty. ● Hint: there is something strange about the first line of input.txt. NB input.txt file contains: min:1,2,3,4,5,6 max:1,2,3,4,5,6 avg:1,2,3,4,5,6 NB could you please give comments with the code for better understanding and for the task def functions is supposed to be used

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
100%

● Create a Python file called amazon.py in this folder.
● Write code to read the content of the text file input.txt.
● For each line in input.txt, write a new line in the new text file output.txt
that computes the answer to some operation on a list of numbers.
● If the input.txt has the following:
o Min: 1,2,3,5,6
o Max: 1,2,3,5,6
o Avg: 1,2,3,5,6
● Your program should generate output.txt as follows:
o The min of [1, 2, 3, 5, 6] is 1.
o The max of [1, 2, 3, 5, 6] is 6.
o The avg of [1, 2, 3, 5, 6] is 3.4.
● Assume that the only operations given in the input file are min, max and
avg, and that the operation is always followed by a list of
comma-separated integers.
● You should define the functions min, max and avg that take in a list of
integers and return the min, max or avg of the list.
● Your program should handle any combination of operations and any
length of input numbers.
● You can assume that the list of input numbers are always valid integers
and that the list is never empty.
● Hint: there is something strange about the first line of input.txt.

NB input.txt file contains:

min:1,2,3,4,5,6
max:1,2,3,4,5,6
avg:1,2,3,4,5,6

NB could you please give comments with the code for better understanding and for the task def functions is supposed to be used

Expert Solution
steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
the output for min, max and average is the same: o min of [1, 2, 3, 5, 6] is 3.4
o max of [1, 2, 3, 5, 6] is 3.4
o avg of [1, 2, 3, 5, 6] is 3.4
Transcribed Image Text:the output for min, max and average is the same: o min of [1, 2, 3, 5, 6] is 3.4 o max of [1, 2, 3, 5, 6] is 3.4 o avg of [1, 2, 3, 5, 6] is 3.4
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
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