[Solved] How to find the nth digit in a list in python


Lists work in an index form. So index[0] of a list is the first item. So to find the nth item in a list, your code would look something like this.

list = [a, b, c, d, e, f, g]
chosen_number = input("Which number would you like from 1-7?")
print("The item {} places into the list is {}".format(chosen_number, list[chosen_number-1]))

Hopefully this helps. This doesn’t account for errors that might occur when the user is typing in e.g. if they type in a word.

0

solved How to find the nth digit in a list in python