0
Please someone should help me how do i get the index of the second "a" pls
9 Antworten
+ 3
You can use the find() method and pass it a starting index which in this case would be the index of the first 'a' + 1.
https://www.geeksforgeeks.org/JUMP_LINK__&&__python__&&__JUMP_LINK-string-find
https://code.sololearn.com/cIb9dm7DyXOb/?ref=app
+ 7
Dragon RB ,
it is not seen as a helpful behavior when we are going to post a code, since the op has not shown a serious attempt here.
it is helpful to give hints and tips, so that the op has a chance to find a solution by himself.
+ 7
Keith Driscoll ,
thanks for this comment from you! that is exactly the same that i am trying to do. but it has become difficult.
when i started with sololearn, one could see on what percentage stage a user in a specific tutorial is. today, you can see only `in progress...` which can mean anything from 1% up to 99%.
what also makes it difficult to find out the level of a user is the fact, that we can't see when he has started a tutorial, which could have happend some months ago.
+ 2
Something else I always keep in mind is the OP's competence level and ability. That's why I usually break up my code examples and use lots of comments.
0
I see you string has multiple 's' in it.
Would it be fun to find ALL index of letter 's'?
https://www.sololearn.com/compiler-playground/c9hfO169Iwgl
0
Thank you so much, imaging i have 3 "a" in the sequence please how do i get the third "a" please??
0
I modify my code above to answer your question.
0
in order to find the second a, use
name = " sagir salisu "
print(name.find("a", name.find("a") + 1))
0
SAGIR ISAH
https://code.sololearn.com/cz7Q6oIDkX7i/?ref=app
This may solve the problem of getting all index of occurrences of the character "a"..