[Python] When print the last part of my list, it prints out the last letter instead of the...

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

  1. Stack

    Stack Membro Participativo

    states_of_america = ["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin", "Wyoming"]



    states_of_america.extend("Motherland")

    print(states_of_america[-1])



    I tried printing the last index on the states_of_america list however it printed d

    I tried printing the last index on the states_of_america list however it printed d which I expect the last letter of Motherland but I actually want the

    Continue reading...

Compartilhe esta Página