Hi i want to create a code that read a text file and print the average of each person in the file, i have this in the folder
boys.txt
ed lin,3,1,4,2
thomas block,6,3,3
Functions.py
def read_txt(file_txt):
file = open(file_txt, "r")
lines = file.readlines()
file.close()
return lines
from Functions import read_txt
file_txt = input("input file: ")
read_txt(file_txt)
lines = (sum(lines)/len(lines))
print(lines)
so i want to print something like
ed lin: 2.5
thomas block: 4
but i dont know how to continue and with my code i get error