[Python] For loop with dynamic list [duplicate]

Discussão em 'Python' iniciado por Stack, Agosto 22, 2025.

  1. Stack

    Stack Membro Participativo

    I have the for-loop:

    L=[1,2,3,4]


    I want, that the code below works:

    for i in range(1,len(L)):
    if i%2==0:
    L.remove(L)


    How can I do this? Many thanks.

    Continue reading...

Compartilhe esta Página