Dec-03-2019, 12:53 PM
(This post was last modified: May-24-2024, 07:13 PM by Larz60+.
Edit Reason: added code tags
)
Hi, i used this code it is getting the index value but i need it to get the index value as the expected output
s = 'Apples are totally awesome' l = [] for idx, item in enumerate(s.lower()): if 'a' in item: l.append(idx) if('l' in item) and ('a' in s[idx-1]): l.append(idx) print(l)Actual output:
Output:[0,7,14,15,20]
Expected output:Output:[0,7,14,15,16,20]