5 Answers
+ 2
Thx Jan Markus andRyan Daniel
+ 1
ThxRĂŒdiger Henze and Peter Parker
0
Look at:
Conversion of string to list
Index
Loops
0
text = input()
for i in range(len(text)):
if(text[i]=='a'):
print(i,end=' ')
0
Hey AnDyOs[SHUBHAM INGALE] You Having More Than 2 Options To Perform This Task
First One Is To Run A Loop And Initialise A Variable Count Which Will Keep Counting The Position Of The Expected Character And Break When We Got It.
And Else You Can Use Methods Of List By Spliting The String By Default Spaces And Then Perform index Method To Catch The First Occurrence Of The Expected Character.
But In Second Option This Will Output You The First Occurrence Of The Character.
Drawback Of Second Option.