This is my code:
results = [[usernme, score]]
with open("hisEasyR.txt", "a") as hisEasyRFile:
writer = csv.writer(hisEasyRFile, delimiter='|')
writer.writerows(results)
This is what the text file looks like:
mary|4
john|5
ben|3
I want to take all the integers and calculate the average. For example, for this file, I would want it to output:
The average is 4.
How would I go about doing this?