Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions choose_your_own_adventure.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
name = input("Type your name: ")
print("Welcome", name, "to this adventure!")
name = input("Type your name: ") #program asks user for name
print("Welcome", name, "to this adventure!") #prints greeting

answer = input(
"You are on a dirt road, it has come to an end and you can go left or right. Which way would you like to go? ").lower()
answer1 = input(
"You are on a dirt road, it has come to an end and you can go left or right. Which way would you like to go? ").lower() #introduces scenario to user

if answer == "left":
answer = input(
"You come to a river, you can walk around it or swim accross? Type walk to walk around and swim to swim accross: ")

if answer == "swim":
if answer1 == "left": #if response is 'left'
answer2 = input( #additional prompt to user
"You come to a river, you can walk around it or swim accross? Type walk to walk around and swim to swim across: ").lower()
#conditionals to answer3
if answer2 == "swim":
print("You swam acrross and were eaten by an alligator.")
elif answer == "walk":
elif answer2 == "walk":
print("You walked for many miles, ran out of water and you lost the game.")
else:
print('Not a valid option. You lose.')

elif answer == "right":
answer = input(
"You come to a bridge, it looks wobbly, do you want to cross it or head back (cross/back)? ")

if answer == "back":
elif answer1 == "right": #if response is 'right'
answer3 = input( #additional prompt
"You come to a bridge, it looks wobbly, do you want to cross it or head back (cross/back)? ").lower()
#conditionals
if answer3 == "back":
print("You go back and lose.")
elif answer == "cross":
answer = input(
"You cross the bridge and meet a stranger. Do you talk to them (yes/no)? ")

if answer == "yes":
elif answer3 == "cross":
answer4 = input(
"You cross the bridge and meet a stranger. Do you talk to them (yes/no)? ").lower()
#conditionals
if answer4 == "yes":
print("You talk to the stanger and they give you gold. You WIN!")
elif answer == "no":
elif answer4 == "no":
print("You ignore the stranger and they are offended and you lose.")
else:
print('Not a valid option. You lose.')
Expand All @@ -37,4 +37,4 @@
else:
print('Not a valid option. You lose.')

print("Thank you for trying", name)
print("Thank you for trying", name)#print ending statement