title: Python function won't return value from a list
body: <p>I am currently having problem with the code below, take a look at it:</p>
  
  <pre><code> def readData(fileName):
      inputFile = open(fileName, 'r')
      yearList = []
      locList = []
      line = inputFile.readline()
      while line != "":
          line = line.strip()
          year, loc = line.split("\t")
          yearList = yearList + [year]
          locList = locList + [loc]
          line = inputFile.readline()
      inputFile.close()
      return yearList, locList
  
  def findLocation(yearList, locList, year):
      location = "Not Found"
      for i in range(len(locList)):
          if locList[i] == year:
              location = locList[i]
      print(location)
  
  def main():
  
      fileName = input("Please enter the name of the file here:")
      yearList, locList = readData(fileName)
      print(yearList)
      print(locList)
      year = int(input("Enter the year you want the function to look for in the data:"))
     location = findLocation(yearList, locList, year)
  </code></pre>
  
  <p>Every time I run the code, It performs everything up to the findLocation function, where it does not return a value, but instead returns "Not Found". I have tried changing the loop around and tried indexes and stuff like that, but I just can not figure out why it keeps returning "Not Found" instead of the location. Can anyone help me? </p>