Apr-26-2021, 05:56 PM
More like this,can add more lines and they will be calculated.
lst = [] with open("number.txt") as f: for line in f: lst.append([int(i) for i in line.split()]) avg = [sum(el) / len(el) for el in lst] print(avg)
Output:[65.5, 53.0]