Question: Python Please!!! Write a program that receives a filename as user input. The file is structured as multiple lines containing numbers separated by a single

Python Please!!!

Python Please!!! Write a program that receives a filename as user input.

Write a program that receives a filename as user input. The file is structured as multiple lines containing numbers separated by a single space. For example, this would be an acceptable file: 1 2 3 7 Your program should open this file and: 1. print all its contents; 2. write the average of all numbers to a new file called result.txt. IMPORTANT NOTES: you should round the average down (should be an integer); you can assume there will be no empty lines; there might be any arbitrary number lines in the file; . there might be any arbitrary number of elements in a single line. Example 1: If input is: filel.txt and the contents of file1.txt are 1 2 you should first print the content, and then write 1 to result.txt. Note that the average of (1+2+2) is 1.6666, and you should round it down to 1 before writing to result.txt. Example 2: If input is: file2.txt and the contents of file2.txt are 1 2 3 5 1 you should first print the content, and then write 2 to result.txt. Note that the average of (1+2+3+4+5+1) is 2.6666, and you should round it down to 2 before writing to result.txt. 296528.7655254.qx3zyy LAB ACTIVITY 13.88.1: File Average (Files) 0/11 Downloadable files file2.txt filel.txt Download main.py 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!