Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- myfile = open('numbers.txt')
- next_line = myfile.readline()
- listA = []
- listB = []
- while next_line != "":
- listA.append(float(next_line.split(",")[0]))
- listB.append(float(next_line.split(",")[1][:-1]))
- next_line = myfile.readline()
- print("The average of the first column is: " + "{:.4f}".format(sum(listA)/len(listA)))
- print("The average of the second column is: " + "{:.4f}".format(sum(listB)/len(listB)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement