How can i make this a def function?
Hello! Firstly, this code is not mine. It is @bobthetomatopie 's code so thanks for that. Secondly, is there a way to make it so that you can do blue('Text here') and the text in that quotes will be blue. Also, how can you do this is other situations. Thanks so much and I really appreciate all the help that you guys give me!
Thanks to everyone who has answered. Appreciate it
To make the text a colour, you can print the code, then the text. The easiest way would be to just do:
print(blue + "Hello world!")
However, if you want a function, you could do:
def printBlue(message): print(blue + message)
This defines the function
printBlue, which does the same as the first code example.
This should do it, but the function is prolly not very usefull when you can just go
print(blue + 'hello')
def blue(text): print(blue + text)
also ppl have already told you this. I just saw i was pinged so i came over to answer as well