Why the Time Complexity of my python code O(N**2) : <p>I am having a tough time understanding how time complexity is calculated for a python code. Why is the time complexity of the below code O(N**2) ?</p>

<pre><code>from itertools import permutations

indices = list(permutations(range(len(A)),2))
indices = list(filter(lambda x: x[0] &lt; x[1], indices))
Y = [(A[i], A[j]) for i,j in indices]

count = sum(x&gt;y for x,y in Y)

if count &gt;= 1000000000:
    count = -1
return count
</code></pre>
