mercredi 19 février 2020

Output sum, avg, and standard deviation from imported text file arrays

my text file, garbageData contains these numbers:

40 50 43 98 20

10 67 84 25 71

37 54 32 90 62

76 49 69 95 44

11 22 33 44 55

I'm trying to read garbageData and store the numbers in an array. Then I need to get a sum, average, and standard deviation of those numbers that are stored.

Then for each number in the array, I need to add a random number ranging from 1 to 10 to that number and store the new number in a different array.

This is what I have so far, but I can't manipulate it. What am I doing wrong?

    with open('garbageData.txt','r') as myArray:
       for x in myArray:
       sum = sum(myArray)   
       print(sum)



Aucun commentaire:

Enregistrer un commentaire