for i, color in enumerate('RGYBMC'): globals()[color] = lambda text, i=i: f'\x1b[{91 + i}m{text}\x1b[0m' print(R('hello'), G('world'))