Как исправить приведенный ниже код для усреднения шагов? [закрыто]Python

Программы на Python
Anonymous
Как исправить приведенный ниже код для усреднения шагов? [закрыто]

Сообщение Anonymous »

#AVERAGE STEPS TAKEN IN 365 DAYS
month = ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August',
'August', 'September', 'Ocotber', 'November', 'December')
days = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
myfile = open('steps.txt', 'r')

for x in range(12):
total = 0
average = 0
for y in range (days[x]):
steps = int(myfile.readline())
total += steps

average = total/ days[x]

print(f"The average steps taken in the month of {month[x]} is {average}")


Подробнее здесь: https://stackoverflow.com/questions/786 ... ging-steps

Вернуться в «Python»