1
I have the following list:
lista = [ 'A','B','C','D']
I want you to count the number of elements up to a certain point, I know if you do len(lista)
will count all the elements but what I want is for example until the C he will give me the number 3.
A for wouldn’t solve your problem?
– Wictor Chaves
but like I used to count up to C just as example, I want to ask a question, and count up to the letter that the person answer
– Arthur Carvalho
But this to make it go, I’ll give you an answer as an example for you
– Wictor Chaves
I would answer, but Marcos . p, made a better code than mine
– Wictor Chaves
@Wictorchaves his answer is different and also from the result expected by him, more than one solution is always welcome! :D
– George Wurthmann
What if there is repeated data in the list? For example,
['a', 'b', 'c', 'd', 'c']
, the result should be 3 or 5? You should always consider the first occurrence?– Woss