Please someone HELP!!!!
I have the below homework and no code I've tried worked so far!!!!!
_________________________________________________________________________________________________________
Write a Python script that will read a text file whose lines contain numbers separated by white-space; as output, the program will produce for each line of the original text file another line that will contain two numbers: the first will be the total number of entries in the line, and the second will be the sum of the numbers in the line.
Example:
Input file (test1.txt) contents:
1 3 5 12 0
2 3
1
-1 1
Expected Output:
Enter text file name: test1.txt
Output:
5 21
2 5
1 1
2 0
I have the below homework and no code I've tried worked so far!!!!!
_________________________________________________________________________________________________________
Write a Python script that will read a text file whose lines contain numbers separated by white-space; as output, the program will produce for each line of the original text file another line that will contain two numbers: the first will be the total number of entries in the line, and the second will be the sum of the numbers in the line.
Example:
Input file (test1.txt) contents:
1 3 5 12 0
2 3
1
-1 1
Expected Output:
Enter text file name: test1.txt
Output:
5 21
2 5
1 1
2 0