Python Day 34 – making a decision tree

Today I started doing some groundwork for a potential mini narrative choose your own adventure coded story. I got stuck for a bit trying to figure out what story to write, but then decided that it was better to just start writing something very rough to practice the coding. So here’s the super random code that I wrote so far:

print(“Cars whip by the outside.\n”)
print(“What color is your car?\n”)
color = input()
print(“\nOh {0} is a brilliant choice”.format(color))

print(“The car reaches a light. And you turn the car to the\n”)
dir1 = input()
if dir1 == “right”:
print(“\nokay right it is”)
print(“\nyou come upon a homeless man, do you pick him up?\n”)
hom1 = input()
if hom1 == “yes”:
print(“\nthe homeless man gets into the car”)
print(“\nyou drive past him”)
print(“okay left it is”)


How does one have a time delay for code to appear? For instance to have several lines of code printed seconds after each other. That’ll be very important for user interaction for a potential interactive experience.

Additionally, is there a way to change the color of printed strings? It’d b nice to have the user answers be in a different color than everything else.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: