I'm trying to go through an array from any position l to the end, but once it reaches the last position instead of leaving the while cycle it shows me an error "list index out of range"
while l <= len(ordenado):
ñ = ordenado[l]
contador2 = contador2+ñ
l = l+1
I've seen many answers about this theme but I haven't been able to apply it to my problem, also any help will be really appreciated.
l < len(ordenado)instead of<=forloop. Or justsum().