title: How to create multiple class objects with a loop in python?
body: <p>Suppose you have to create 10 class objects in python, and do something with them, like:</p>
  
  <pre><code>obj_1 = MyClass()
  other_object.add(obj_1)
  obj_2 = MyClass()
  other_object.add(obj_2)
  .
  .
  .
  obj_10 = MyClass()
  other_object.add(obj_10)
  </code></pre>
  
  <p>How would you do it with a loop, and assign a variable to each object (like <code>obj_1</code>), so that the code will be shorter? Each object should be accessible outside the loop</p>
  
  <pre><code>obj_1.do_sth()
  </code></pre>