[Python] Why is my Python list index out of range? python Copy Edit my_list = [1, 2, 3]...

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

  1. Stack

    Stack Membro Participativo

    I have a python list with 3 items in it: my_list = [1, 2, 3]

    However, when I run:

    my_list = [1, 2, 3]
    print(my_list[3])


    I get an IndexError, but I don't understand why, as there are 3 items in the list. Can someone explain what's wrong?

    Continue reading...

Compartilhe esta Página