how can I make a average store in a File? every time i run the code it say “No such file or directory: 'numbers.txt'”
def main():
numbersFile = open("numbers.txt", "r")
total = 0
numbersLines = 0
line = numbersFile.readLine()
while line != "":
numbersLines += 1
total += int(line)
line - numbersFile.readline()
average = total / numbersLines
print("the average is", average)
main()
Comments
Post a Comment