0

Im trying to find out the number of where X is in the list e.g: if i had a list like: ['a','b','c','d'] and i have 'c' how would i find where it is in the list, so that it would print '2' (as thats where it is in the list) thanks

Jared Parker
  • 390
  • 2
  • 3
  • 16
  • 2
    Possible duplicate of [How to get item's position in a list?](http://stackoverflow.com/questions/364621/how-to-get-items-position-in-a-list) – Damaged Organic Sep 11 '16 at 13:38

1 Answers1

1

Use the built-in method list.index

If you wanna know where is 'c': l = ['a','b','c']

l.index('c')

  • If Marques provided an answer that is actually a solution to your problem, you should mark his answer as solution. – MaxPowers Sep 19 '16 at 16:05