altitudes = [30, 10, 40, 20, 50]
answer = 0

for i in range(len(altitudes)):
    for j in range(i+1, len(altitudes)):
        if altitudes[i] > altitudes[j]:
            answer += 1

print(answer)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: