0

Please someone should help me how do i get the index of the second "a" pls

https://code.sololearn.com/cv6PQkmVQIWA/?ref=app

16th Sep 2023, 11:06 PM
SAGIR ISAH
SAGIR ISAH - avatar
9 odpowiedzi
+ 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
16th Sep 2023, 11:46 PM
Keith
Keith - avatar
+ 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.
18th Sep 2023, 7:07 PM
Lothar
Lothar - avatar
+ 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.
18th Sep 2023, 8:43 PM
Lothar
Lothar - avatar
+ 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.
18th Sep 2023, 8:25 PM
Keith
Keith - avatar
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
17th Sep 2023, 2:36 AM
Wong Hei Ming
Wong Hei Ming - avatar
0
Thank you so much, imaging i have 3 "a" in the sequence please how do i get the third "a" please??
17th Sep 2023, 2:42 AM
SAGIR ISAH
SAGIR ISAH - avatar
0
I modify my code above to answer your question.
17th Sep 2023, 5:38 AM
Wong Hei Ming
Wong Hei Ming - avatar
0
in order to find the second a, use name = " sagir salisu " print(name.find("a", name.find("a") + 1))
18th Sep 2023, 1:08 AM
Liam Park
Liam Park - avatar
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"..
18th Sep 2023, 4:59 PM
Dragon RB
Dragon RB - avatar