title: Avoiding repetition in for loop
body: <p>given this data structure (variable in size):</p>
  
  <pre><code>items =   [(u'Triathalon ', u' Teenager'), (u'The Airplanes ', u' Paper Hearts'), (u"Holy '57 ", u' Island Kids'), (u'Yohuna ', u' Apart'), (u'Moon Bounce ', u' Shake'), (u'Miami Horror ', u' Wild Motion (Set It Free)'), (u'Colleagues ', u' Somewhere'), (u'Poor Spirits ', u' BwooKlyn'), (u'Air Review ', u' Young'), (u'Radiohead', u'Karma Police')]
  </code></pre>
  
  <p>I would like to do this:</p>
  
  <pre><code>if len(items) &gt; 10:
     for artist, track in random.sample(items, 10):
         # do a lot of things in many lines of code
  elif len(items) &lt; 10:
     for artist, track in items:
         # do the exact same thing
  </code></pre>
  
  <p>but this is rather redundant.</p>
  
  <p>what is the simplest way of achieving the same result without repeating myself?</p>