Light Mode
Dark Mode
Help - Substring not found / Wrong Index

I'm new to Python so might be making a clear error but would appreciate some help on why this code is producing a substring not found error. Thanks!

def second_index(text: str, symbol: str): if symbol in text: txt = list(text) n = txt.index(symbol) for pp in txt[n+1:]: return pp.index(symbol) else: return None

Created: Jan. 14, 2020, 8:41 a.m.
Updated: Jan. 15, 2020, 5:51 a.m.
0
9
User avatar
phillycheesesteak