title: Average Steps Taken
body: <p>My program runs but it only outputs "MONTH | AVERAGE". I need it to post how many steps are taken in each month.</p>
  
  <pre><code>days = [31,28,31,30,31,30,31,31,30,31,30,31]
  months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  firstIndex = 0
  lastIndex = 0
  
  inputFile = open(r'C\Users\UserName\Downloads\steps.txt', 'r')
  outputFile = open(r'C\Users\UserName\Downloads\stepsbymonth.txt', 'w')
  
  outputFile.write('MONTH | AVERAGE\n')
  print('MONTH | AVERAGE\n')
  lines = inputFile.readlines()
  lines = list(map(int,lines))
  
  for x in range(0, 12):
      lastIndex = firstIndex + days[x]
      monthLines = lines[firstIndex:lastIndex]
      average = float(sum(monthLines)) / max(len(monthLines),1)
      outputFile.write(months[x] + '|' + '{0:.1f}'.format(average)+ '\n')
      firstIndex = lastIndex
  
  inputFile.close()
  outputFile.close()
  </code></pre>