[Python] How do I get the last element of a list? [closed]

Discussão em 'Python' iniciado por Stack, Junho 6, 2025.

  1. Stack

    Stack Membro Participativo

    How do I get the last element of a list? Which way is preferred?

    alist[-1]
    alist[len(alist) - 1]

    Continue reading...

Compartilhe esta Página