title: How to print the list in 'for' loop using .format() in Python?
body: <p>I'm a newbie to Python. I'm writing a very simple piece of code to print the contents of a list using 'for' loop with <code>.format()</code> and I want the output as below, but I'm getting this error:</p>
  
  <pre><code>names = ['David', 'Peter', 'Michael', 'John', 'Bob']
  for i in names:
      print("{}.{}".format(i, names[i])) 
  </code></pre>
  
  <hr>
  
  <pre><code>print("{}.{}".format(i,breakfastMenu[i]))
  TypeError: list indices must be integers or slices, not str
  </code></pre>
  
  <p>Expected output I want:
  1. David
  2. Peter
  3. Michael
  4. John
  5. Bob</p>
  
  <p>Can someone please help me to get that output? </p>