title: returns the location of the first item for the whole list instead of each item's location?
body: <p>this code is supposed to read a text file of a genome, and given a pattern, should return how many times the pattern occurred, and its location.
  instead, it returns the number of occurrences and the location of the first occurrence only.
  <a href="https://i.stack.imgur.com/pOrpm.png" rel="nofollow noreferrer">this is an example of running the code</a> instead of returning the location of the 35 occurrences, it returns the first location 35 times.</p>
  <pre><code># open the file with the original sequence
  myfile = open('Vibrio_cholerae.txt')
  
  # set the file to the variable Text to read and scan
  Text = myfile.read()
  
  # insert the pattern
  Pattern = &quot;TAATGGCT&quot;
  
  PatternLocations = []
  
  def PatternCount(Text,Pattern):
      count = 0
      for i in range (len(Text)-len(Pattern)+1):
          if Text [i:i+len(Pattern)] == Pattern:
              count +=1
              PatternLocations.append(Text.index(Pattern))
      return count
  
  
  # print the result of calling PatternCount on Text and Pattern.
  print (f&quot;Number of times the Pattern is repeated: {PatternCount(Text,Pattern)} time(s).&quot;)
  print(f&quot;List of Pattern locations: {PatternLocations}&quot;)
  </code></pre>