[Python] Short for 'for i in range(1,len(a)):' in python

Discussão em 'Python' iniciado por Stack, Julho 12, 2025.

  1. Stack

    Stack Membro Participativo

    In python, is there a short way of writing for i in range(len(l)):?

    I know I can use for i,_ in enumerate(l):, but I want to know if there's another way (without the _).

    Please don't say for v in l because I need the indices (for example to compare consecutive values l==l[i+1]).

    Continue reading...

Compartilhe esta Página