Compulsory Task 3 Follow these steps: Create a Python file called amazon.py in your folder. Write code to read the content of the text file input.txt. Tip: After stripping and splitting each line in the file, add the key.value pairs to a dictionary. For each line of data compute the answer for the min, max, and avg operations on a list of numbers. The input consists of the following data: O min: 1,2,3,4,5,6 max: 1,2,3,4,5,6 o avg: 1,2,3,4,5,6 O You should define the functions min, max, and avg that take in the respective list of integers and return the min, max, or avg of the list. Take Note: o You can 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. O You can assume that the list of input numbers are always valid integers and that the list is never empty, so as not to have to write code to check for these cases. o Your program should handle any combination of operations and any length of input numbers. Finally, write the values returned from each function to a new line in a new text file output.txt. Your program should output as follows: o The min of [1, 2, 3, 4, 5, 6] is 1. o The max of [1, 2, 3,4, 5, 6] is 6. o The avg of [1, 2, 3, 4, 5, 6] is 3.5.
Compulsory Task 3 Follow these steps: Create a Python file called amazon.py in your folder. Write code to read the content of the text file input.txt. Tip: After stripping and splitting each line in the file, add the key.value pairs to a dictionary. For each line of data compute the answer for the min, max, and avg operations on a list of numbers. The input consists of the following data: O min: 1,2,3,4,5,6 max: 1,2,3,4,5,6 o avg: 1,2,3,4,5,6 O You should define the functions min, max, and avg that take in the respective list of integers and return the min, max, or avg of the list. Take Note: o You can 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. O You can assume that the list of input numbers are always valid integers and that the list is never empty, so as not to have to write code to check for these cases. o Your program should handle any combination of operations and any length of input numbers. Finally, write the values returned from each function to a new line in a new text file output.txt. Your program should output as follows: o The min of [1, 2, 3, 4, 5, 6] is 1. o The max of [1, 2, 3,4, 5, 6] is 6. o The avg of [1, 2, 3, 4, 5, 6] is 3.5.
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...
Related questions
Question
![<
Compulsory Task 3
Follow these steps:
●
●
●
Create a Python file called amazon.py in your folder.
Write code to read the content of the text file input.txt.
Tip: After stripping and splitting each line in the file, add the key:value
pairs to a dictionary.
Hyperionday
For each line of data compute the answer for the min, max, and avg
operations on a list of numbers.
The input consists of the following data:
O
O
O
You should define the functions min, max, and avg that take in the
respective list of integers and return the min, max, or avg of the list.
min: 1,2,3,4,5,6
max: 1,2,3,4,5,6
avg: 1,2,3,4,5,6
Take Note:
O You can 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.
O You can assume that the list of input numbers are always valid
integers and that the list is never empty, so as not to have to write
code to check for these cases.
O
● Finally, write the values returned from each function to a new line in a
new text file output.txt.
Your program should output as follows:
Your program should handle any combination of operations and
any length of input numbers.
O
O The min of [1, 2, 3, 4, 5, 6] is 1.
The max of [1, 2, 3,4, 5, 6] is 6.
O The avg of [1, 2, 3, 4, 5, 6] is 3.5.
SE L1T22 - Beginner Programming with Function...
120% +
JL
חר
10 of 12 V
3 of 3
Copyright © 2018 Hyperion Development All rights rosorvad
>
X](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fd617169e-4a05-4922-8a0f-ead8c2f4c9ba%2Fdd133fde-d17c-4bbb-a314-bccd8645f69a%2F7yvncpl_processed.png&w=3840&q=75)
Transcribed Image Text:<
Compulsory Task 3
Follow these steps:
●
●
●
Create a Python file called amazon.py in your folder.
Write code to read the content of the text file input.txt.
Tip: After stripping and splitting each line in the file, add the key:value
pairs to a dictionary.
Hyperionday
For each line of data compute the answer for the min, max, and avg
operations on a list of numbers.
The input consists of the following data:
O
O
O
You should define the functions min, max, and avg that take in the
respective list of integers and return the min, max, or avg of the list.
min: 1,2,3,4,5,6
max: 1,2,3,4,5,6
avg: 1,2,3,4,5,6
Take Note:
O You can 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.
O You can assume that the list of input numbers are always valid
integers and that the list is never empty, so as not to have to write
code to check for these cases.
O
● Finally, write the values returned from each function to a new line in a
new text file output.txt.
Your program should output as follows:
Your program should handle any combination of operations and
any length of input numbers.
O
O The min of [1, 2, 3, 4, 5, 6] is 1.
The max of [1, 2, 3,4, 5, 6] is 6.
O The avg of [1, 2, 3, 4, 5, 6] is 3.5.
SE L1T22 - Beginner Programming with Function...
120% +
JL
חר
10 of 12 V
3 of 3
Copyright © 2018 Hyperion Development All rights rosorvad
>
X

Transcribed Image Text:min: 1,2,3,4,5,6
max:1,2,3,4,5,6
avg: 1,2,3,4,5,6
<
input.txt
JL
חר
2 of 3
>
Expert Solution

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

Recommended textbooks for you

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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

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
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY