Reputation: 21
I'm new to python, and I'm wondering if there is a way to identify the index position of something in python?
For example, if I have a string consisting of the alphabet a-z, and I ask the user to input a letter, is there a way I can make the program identify that the letter "f" has the index 5 in the alphabet string?
Upvotes: 0
Views: 6653
Reputation: 20249
Do you mean like this?
alpha = "abcdefghijkl..."
alpha.index("f")
Upvotes: 6