logo

Crowdly

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

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

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

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на elearn.squ.edu.om?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!