Answer:
Following is the program code as required.
Comments are given inside the code.
Explanation:
(=> Defining the main function)
def main():
(=> Getting input from user)
file = input("What is name of file?")
(=>Storing text from file in variable data )
data = open(file, "r")
(=> read the file and then split it)
info = data.read().split()
(=> Generating array named numbers)
numbers = []
for line in info:
(=>numbers will be appended from in format to list format)
numbers.append(int(line))
data.close()
(=> Average will be found by dividing sum of numbers to length of array)
avg = float(sum(numbers))/len(numbers)
(=> Printing calculation of average)
print("Calculated average is",avg)
main()
<h2>i hope it will help you!</h2>