Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In Python Using read file and process numbers The list of numbers below represen

ID: 3918092 • Letter: I

Question

In Python

Using read file and process numbers

The list of numbers below represents a txt file (test.txt)

-10.923

-6.11

-7.2934

-8.41

-9.5

-7.8111

-2.534

-6.912

-7.93456

-2.222

-5.432

-7.111

-9.324

-5.43

-7.83

-9.284

-7.1134

-9.234

-7.2134

-8.454

-1.2345

-9.231

All values are greater than 0 and less than 100.

Read in the file represented above (test.txt) and find the following:

-largest number

-smallest number

-total of all the numbers in the file.

Print the three numbers on a single line using the following format:

-print(“largest:%d smallest: %d total: %10.2f”%(largest,smallest,total)

Thank you for your assistance in advance.

Explanation / Answer

largest = 0 smallest = 100 total = 0 with open('test.txt', 'r') as f: for line in f: num = float(line.strip()) if num > largest: largest = num if num
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote