Day 004 - Project 4 : Adventure Simulator

If you have any questions, comments or issues with this project please post them here!

Hey, on Day4 colours were added as a bonus and somehow that particular part didn‘t work out for me. On Day20, it‘s suggested we use different colours again … and I tried and failed again. Unfortunately, the usually so very helpful solutions didn‘t help because they don‘t include the colour idea. I would love to see an example of code with colours - be it as a solution to Day4 or Day20 - if that‘s possible!

Here’s my attempt at day 4:

Thank you, MattDESTROYER, very much for sharing your version! I forked (is that the verb?!) it and had a look at the colour part … and it DID destroy me:) … you did way more than a real beginner could have done on Day4 of this 100 Day course. I‘ll put it aside for now and revisit it later when it (hopefully) looks less daunting than just now! Anyhow: Thank you! One day I‘ll surely understand what you have done to make it look so smart …

1 Like

It’s true, I’m not a beginner, but I honestly don’t know much Python so…

It’s really not that complex, I just created a helper function to make it easier for me and to make the code a little cleaner. The tutorial tells you you can do print("\033[ < colour > m"), then gives you a list of values for different colours. If you combine them, you can create this:

default = "\033[0m"
black = "\033[30m"
red = "\033[31m"
green = "\033[32m"
yellow = "\033[33m"
blue = "\033[34m"
purple = "\033[35m"
cyan = "\033[36m"
white = "\033[37m"

Basically, you print the colour you want to use, then the text you want to colour (but don’t forget to reset the colour to default if you want to stop using colours, because this will not automatically happen).

For example:

print(red + "Red", yellow + "Yellow", green + "Green", cyan + "Cyan", blue + "Blue", black + "Black", white + "White")

And here’s what that would look like:

Hope this helps :smiley:


Anjalene, to expand on what MattDESTROYER explained to you with his example. If you didn’t have the helper function, you would just type in something like the following if this helps.

print(“This is a \033[31mRed\033[0m word.”)

The above example should print the word Red in red color. The first color change using the \033[31m changes the color before the word Red to the color red and then the color change after the word Red using the \033[0m changes the color back to the default color before the last of the string ending in “word.”. Hope this helps.


Thank you, UlyTheHumble. I will revisit the colours in a couple of days with your help and MattDestroyer’s. I’m sure I will manage now! Thanks again to both of you!

1 Like

Thank you so much, MattDestroyer, for all your help! I’m sure I can do it now thanks to you (and UlyTheHumble)!


I can’t figure out how to use colored print I learned from day 4 of 100 days of code in python IDLE

here’s the code i learned
print(“\033[32m”, ‘Hello’)

Hey @ParanormalCoder, welcome!

You can also use this method :

from termcolor import colored


I personally like it more!


Thanks i’ve been trying to figure that out for a while :grinning:

code has been updated!