Dec-03-2019, 12:53 PM (This post was last modified: Dec-03-2019, 12:56 PM by chihaya. Edited 3 times in total.)
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:
[0,7,14,15,20]
Expected output:
[0,7,14,15,16,20]
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:
[0,7,14,15,20]
Expected output:
[0,7,14,15,16,20]
buran wrote Dec-03-2019, 12:51 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.