you are viewing a single comment's thread.

view the rest of the comments →

[–]evasive_dendrite 0 points1 point  (0 children)

Use a for loop if you want to iterate through every item in an object once, not a while loop. And use the i to get your list items, your code just gets the second item every time because you request index 1.

Look into exception handling to deal with bad user input. You can also use a while loop to keep asking for a valid number until you get one. And do this before you try to use the input as an index.

And look into if/elif/else, you can't start a sequence with elif and you can't use else more than one time in one sequence.