# 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: https://replit.com/@MattDESTROYER/Day-4?v=1

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

4 Likes

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.

Example:
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.

4 Likes

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)!

2 Likes

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

print(colored("Hello","red"))
``````

I personally like it more!

3 Likes

Thanks iāve been trying to figure that out for a while

code has been updated!

Do you think it will work outside the replit?

Feel like a proper storyteller with the custom storybook that I coded up !

#Replit100DaysOfCode #100DaysOfCode.

1 Like

`termcolor` is a Python package, so as long as it is installed this will work. Replit automatically installs packages for you so outside of Replit there might be more steps involved (also note the Replit console may look slightly different to whatever console your operating system has), but it will definitely still work.

2 Likes

(This is a note mostly for me but where others can read. This is mostly just to keep me going and motivated to finish the 100 Days Of Code.)
Day 4- Today was a lot more fun I would say with the coding part of things. We had built a store sort of where you can answer and see what will go on. I canāt wait to get into some things that I havenāt done before so I can learn from the challenge. I hope to be moving into the stuff I donāt know and I think that will start happening quite soon. I think at the pace the course is going I should get into that stuff very soon.
Extra Note:
Once again, I am quite worried as tomorrow marks the start of my first weekend while being on this challenge. Like I said in my last post on Day 3:

I hope I wonāt forget as I am having a lot of fun with this.

1 Like

Question:
what does this error mean:

``````name = input("Hello! What is your name?: ")
car = input("Ok, " + name + " what is your favourite car?: ")
place = input("Ok," + name + " where would you drive in your ", car, "?: ")
hates = input("Ok, " + name + " what do you hate the most?: ")
car = input("Ok, " + name + " what is the name of your father?: ")
``````

(https://replit.com/@BananaPi/day4100-days)

``````name = input("Hello! What is your name?: ")
car = input("Ok, " + name + " what is your favourite car?: ")
place = input("Ok," + name + " where would you drive in your ", car, "?: ")
hates = input("Ok, " + name + " what do you hate the most?: ")
car = input("Ok, " + name + " what is the name of your father?: ")
``````

You forgot a + to concatenate strings.

1 Like

Ok, thanks. But in the tutorial, it says you can use commas to do this as well.

``````number = input("Give me a number: ")
group = input("Give me a collective noun for a group of things: ")
thing = input("Give me the name of a weird or wacky thing: ")
print("No I don't think that", number, "is a", group, "of", thing,". That's just odd.")
``````

(this is in day 3 of the 100 days of code)