comparing sub-list elements in list using python : <p>i have a list a=[[1,2],[3,4],[5,6]] and i need to check if all elements in sublist are in ascending order (e.g [1,2] is less than [3,4] and [5,6], and [3,4] is less than [5,6] and so on).
i use the following function:</p>

<pre><code>def FirstRuleLink (L):
    for i in range(0,len(L)):
        for j in range(0,len(L[i])):
            if L[i][0]&lt;L[i+1][0] and L[i][1]&lt;L[i+1][1]:
                return True
            else:
                return False
</code></pre>

<p>but the python gives me error message that index is out of range. so how could i change this code to get the correct output.</p>
