title: how to add counter to a list using a for loop?
body: <p>i am writing a function that takes a dictionary, and for each key it puts the key and value in a list with a number representing the order. example, dictionary: {&quot;key1&quot;: &quot;value1&quot;, &quot;key2&quot;: &quot;value2&quot;, &quot;key3&quot;: &quot;value3&quot;}. the list should look like  this [&quot;1) key1: value1&quot;, &quot;2) key2: value2&quot;, &quot;3) key3: value3&quot;].</p>
  <p>I am able to get it so that it puts all of the dictionary items in a list, but I cant get it so that the numbers appear. this is the code that I have written so far:</p>
  <pre><code>def listItems(index):
      things = []
      for x,y in index.items():
          things.append(str(x)+&quot;: &quot;+str(y))
      return things
      
  thisdict = {
    &quot;key1&quot;: &quot;value1&quot;,
    &quot;key2&quot;: &quot;value2&quot;,
    &quot;key3&quot;: &quot;value3&quot;
  }
  
  print(listItems(thisdict))
  </code></pre>
  <p>I have tried doing this for the numbers, but it does not work:</p>
  <pre><code>def listItems(index):
      things = []
      for x,y in index.items():
          for i in range(len(index))
              things.append(str(i)+&quot;) &quot;+str(x)+&quot;: &quot;+str(y))
      return things
      
  thisdict = {
    &quot;key1&quot;: &quot;value1&quot;,
    &quot;key2&quot;: &quot;value2&quot;,
    &quot;key3&quot;: &quot;value3&quot;
  }
  </code></pre>