logo

Crowdly

Write a Python program  that reads a file containing numbers (possibly across m...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Write a Python program  that reads a file containing numbers (possibly across multiple lines). The program should:

  1. Convert the values to floats.

  2. Store them in a list.

  3. Compute and print the average (mean) of all numbers in the file.

A sample text is given by:

10 20 30

25 35

15 5 10

A sample code execution is:

Enter the filename: text3.txt

The average is 18.75

More questions like this

Want instant access to all verified answers on elearn.squ.edu.om?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!