Stay With us
3 new comments

beginner
new

Help & Settings
About
Help
Tips

How to get the index of item in list in python

I have a list which contains the data of different people such as

data = ['john', '5.5', 'Alice', '5.0', 'Smith', '5.8', 'Kelvin', '6.0']

Now i want to enter a string or the floating value in a method that should return me the index of that.

For example if i want to get the index number of Smith then the method should return me the index of that item in the list. How can i do it in python?

Kelvin C
40 Points

(1) Replies

Please login or register to Comment or Answer