Reputation: 1
How can I return where something is located on a list? For example, if you have List = [a, b, c] and the user inputs c the program should return 2. How can I code this though?
Upvotes: 0
Views: 27
Reputation: 7340
Try this:
> my_list = ["a", "b", "c"] > my_list.index("c") 2
Upvotes: 1