#365 天内平均步数 月 = ('一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', “八月”、“九月”、“十月”、“十一月”、“十二月”) 天 = (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}")
for x in range(12):
total = 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:.2f}")