title: Python Loop Only Iterating once with Large loop which takes input from a file
body: <p>I'm doing this project and it needs to take input from names from the  <a href="https://www.ssa.gov/oact/babynames/limits.html" rel="nofollow noreferrer">https://www.ssa.gov/oact/babynames/limits.html</a>
  , so i created a loop to get all the names in the file and then made another to check for the largest name. However the loop only seems to run through once and gives the first name in the list. Is there a way to make it so it goes through the list?</p>
  
  <pre><code>    ## https://www.ssa.gov/oact/babynames/limits.html
  file = open('yob2003.txt', 'r')
  # variables to store the most popular name
  # and the most popular name count
  most_pop_name = ""
  allNames = set()
  count = 0
  
  for line in file:  # loop to check for names
      list = line.split(',')
      if int(list[2]) &gt; 100:  # not worth to work with stuff under 100
          allNames.add(list[0])
  print(len(allNames))
  
  bigList = sorted(allNames)
  
  file.close()
  file = open('yob2003.txt', 'r')
  for x in range(len(bigList)):  # big loop that goes through once
      total = 0
      for line in file:
          list = line.split(',')
          if bigList[x] == list[0]:
              total += int(list[2])
  
      if total &gt; count:
          most_pop_name = str(list[0])
          total = count
  
      #  print most popular name
  
  print("Most popular name in [NJ] :: " + str(most_pop_name) + " " + str(count))
  </code></pre>