1 #average5.py
2 defmain():3 fileName = input("What file are the numbers in?")4 infile = open(fileName, 'r')5 sum =06 count =07 for line ininfile:8 sum = sum +eval(line)9 count = count + 1
10 print("\nThe average of the numbers is",sum/count)11 main()12
13
14 #================= RESTART: C:/Users/home/Desktop/average.py =================
15 #What file are the numbers in?C:\Users\home\Desktop\python4\num.txt
16
17 #The average of the numbers is 10.5