"The first and last occurrence: Given a string that may or may not contain a letter of interest. Print the index location of the first and last appearance of f. If the letter f occurs only once, then output its index. If the letter f does not occur, then do not print anything. Don't use loops in this task. " - Snakify python coding question
on
Get link
Facebook
X
Pinterest
Email
Other Apps
CODING QUESTION
Here is question
SOLUTION
s=str(input()) if s.count('f')==0: print() elif s.count('f')==1: print(s.find('f')) else: print(s.find('f'),s.rfind('f'))