HELP! simple python code needed

I’ve been trying to solve the below simple exercise but no code I’ve tried worked so far, I’m using python 3 spyder


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

3 posts were merged into an existing topic: Python Homework Help! Simple Code Needed

Please do not create duplicate topics for the same challenge/project question(s). This duplicate topic has been unlisted.

Thank you.