title: Python return issues
body: <p>So I'm writing a program that creates a file and then reads through it and prints the maximum and minimum value in the file and returns the average of all the values in the file. This is a homework assignment and my teacher asked specifically for the printing and returning differences so that's why those are there.</p>
  
  <p>I got the program running smoothly and working just the way I want it to, but after i put my function at the end so it automatically runs when the shell is reset it messed up the end of my code and it won't return the average anymore. Before I put the function at the end and I did everything manually it worked like a charm. I was hoping you guys might be able to help me figure out why it's cutting the average out when I put my function at the end of the program. Thanks for taking the time to read through and help me out, I really appreciate it.</p>
  
  <p>I realize there's probably a lot simpler ways I could've done this, but I'm fairly new with Python. All I'm really looking for is why it's cutting my average off in my results when I put my function in at the end.
  Here's my code:</p>
  
  <pre><code>    def summaryStats():
          fileName = input("Enter a file name please: ")
          outputFile = open(fileName, "w")
          numberstoGenerate = int(input("Please enter how many units long you would like the list to be: "))
          while numberstoGenerate &gt; 0:
              randomNumber = int(random.random()*1000)
              outputFile.write(str(randomNumber) + "\n")
              numberstoGenerate = numberstoGenerate - 1
          outputFile.close()
          file = open(fileName, "r")
          average = 0
          myList = file.readlines()
          myList = myList[0:]
          print("The maximum value is " + str(max(myList)))
          print("The minimum value is " + str(min(myList)))
          for element in myList:
              average = average + int(element)
          return average/len(myList)
  
      summaryStats()
  </code></pre>