1from functools import reduce
2from itertools import chain
3
4text = 'left foot right foot left foot right. Feet in the day, feet at night.'
5l1 = ['foot','feet']
6
7print(reduce(lambda t, x: t.replace(*x), chain([text.lower()], ((t, colored(t,'white','on_red')) for t in l1))))
8