Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a complete Python program, called final.py, which will read integer values from the file numbers.txt. The program should determine the average of the

Write a complete Python program, called final.py, which will read integer values from the file numbers.txt.

Write a complete Python program, called final.py, which will read integer values from the file numbers.txt. The program should determine the average of the numbers in the file and then add that number to all the numbers less than the average or subtract from all the numbers greater than the average. You cannot read the file more than once so you should use the list to store the values. There should be a main function that calls a calcAvg(list) function which accepts a list of numbers and returns the average. Sample run: (numbers.txt has the following values) 1 2 2345 4 The average of the numbers is: 31 Adjusting the numbers in the list: 45312

Step by Step Solution

3.60 Rating (157 Votes )

There are 3 Steps involved in it

Step: 1

Answer the code is as follow def calcAvgnumbers if not numb... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual C# How to Program

Authors: Paul J. Deitel, Harvey Deitel

6th edition

134601548, 134601793, 978-0134601540

More Books

Students also viewed these Programming questions

Question

600 lb 20 0.5 ft 30 30 5 ft

Answered: 1 week ago