title: How do I change an element in a nested list?
body: <p>I am a Python beginner and in need of some advice.</p>
  <p>I defined ten variables that all have an X and Y value.</p>
  <p>Then I put these variables (which are actually a list) in another list called &quot;pointlist&quot;.</p>
  <p>Now, I want to use a <strong>for-loop to change the X-value of each variable</strong>.</p>
  <p>Usually, I can access the X-value of the first variable through &quot;pointlist[0][0]&quot;.</p>
  <p>When I applied this to the for-loop I got the following error:
  &quot;TypeError: list indices must be integers or slices, not tuple&quot;</p>
  <p>Does anyone have an idea what I missed? Thank you so much in advance!</p>
  <pre><code>import random 
  X=1350
  Y=250
  
  p1=[X, Y]
  p2=[X, Y]
  p3=[X, Y]
  p4=[X, Y]
  p5=[X, Y]
  p6=[X, Y]
  p7=[X, Y]
  p8=[X, Y]
  p9=[X, Y]
  p10=[X, Y]
  p11=[X, Y]
  pointlist = [p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11]
  
  limit1=1150
  limit2=1250
  
  for i in enumerate (pointlist, start=1):
      pointlist[i][0] = random.randrange(limit1, limit2)
      limit1-=100
      limit2-=100
  </code></pre>