title: Is there a possibility to use a "for loop" to access different lists?
body: <p>I am trying to use a for loop to make changes to different lists as follows:</p>
  <pre><code># Variable that indicates who scored a goal. Can either take value a or b.
  goal = &quot;a&quot;
  
  # Initiate points counter
  points_a = [0]
  points_b = [0]
  
  players = [&quot;a&quot;, &quot;b&quot;]
  
  for x in players:
      if goal == x:
          points_x[0] += 1
  
  print(points_a)
  
  </code></pre>
  <p>I would like to update the &quot;points counter&quot; depending on whether goal takes the value a or b but am struggling to find a way to tell Python that I am trying to access the lists within the loop. My desired output in this case, where goal is set to &quot;a&quot; is &quot;[1]&quot;. At the moment I am just getting the error &quot;NameError: name 'points_x' is not defined&quot;. Is there a way to do this in Python?</p>
  <p>Thankful for any hints!</p>
  <p>Manuel</p>