defput_colour(txt,color=None):if color =='red':
result =f"\033[31m{txt}\033[0m"elif color =='green':
result =f"\033[32m{txt}\033[0m"elif color =='yellow':
result =f"\033[33m{txt}\033[0m"elif color =='blue':
result =f"\033[34m{txt}\033[0m"elif color =='violet':
result =f"\033[35m{txt}\033[0m"elif color =='cyan':
result =f"\033[36m{txt}\033[0m"elif color =='gray':
result =f"\033[37m{txt}\033[0m"elif color =='black':
result =f"\033[30m{txt}\033[0m"else:
result = txt
return result
txt ='hello world!'print(put_colour(txt))print(put_colour(txt,color='red'))print(put_colour(txt,color='green'))print(put_colour(txt,color='yellow'))print(put_colour(txt,color='blue'))print(put_colour(txt,color='violet'))print(put_colour(txt,color='cyan'))print(put_colour(txt,color='gray'))print(put_colour(txt,color='black'))