Вы также можете использовать enumerate
:
s = "Hello world this is my code"
cl = [(4,"this") , (7,"that") , (10 , "other")]
new_cl = dict(cl)
result = ''.join(a if i not in new_cl else f"<{new_cl[i]}>{a}" for i, a in enumerate(s))
Выход:
'Hell<this>o w<that>orl<other>d this is my code'