Refactoring a python function so that it can take any sized list <p>How can I make this function take as input an arbitrary list size?</p> <pre><code>def ugly_function(lst): for a in lst[0]: for b in lst[1]: for c in lst[2]: for d in lst[3]: for e in lst[4]: for f in lst[5]: for g in lst[6]: for h in lst[7]: if some_test([a,b,c,d,e,f,g,h]): return [a,b,c,d,e,f,g,h] </code></pre>