May-24-2018, 08:13 AM
first check for not before bad, the logic:
tstring = 'This tea is hot'
tstring = 'This tea is hot'
try: idx = tstring.index('not') idx1 = tstring.index('bad') if idx < idx1: ... change string here return changed string except: return unaltered string