title: Loop over multiple variables previously assigned with the form var{num} in another loop
body: <p>I am currently trying to make a calculator and I want to create the buttons for numbers in a loop, rather than 10 different hard-coded variables.</p>
  <p>I am now trying to take a previously loop-made series of variables (i.e. var0 to var9) and do something with it, but I am stuck at how to do that.</p>
  <p>Here's my code for reference:</p>
  <pre><code>x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
  
  for num in range(0, 10):
      exec (f'var{num} = x[num]')
      for i in range(0, 10):
          exec (f'btn{i} = Button(calc, padx=16, bd=8, fg=&quot;black&quot;, font = (&quot;Times New Roman&quot;, 18, &quot;bold&quot;), text = x[i], command = lambda:btnClick(x[i]))')
          
  </code></pre>
  <p>What I have in mind now is to do something like:</p>
  <pre><code>for j in range(0, 10):
       btn{j}.grid(row = , column = )
  </code></pre>
  <p>as a third for loop and I don't know how to do extract btn{j} part. Any ideas would be appreciated!</p>
  <p><em>Apologies if the code is cringeworthy, I am a beginner</em></p>