I'm very new to programming and was doing a simple choice game:
Answer = (input("You meet a bear, what do you do? A) Give the bear a hug B) Run away"))
if Answer == ("A)"):
print("The bear chopped your hand off!")
else:
print("Good choice, but the bear is running after you")
But how do I go on? Like add an option after having proceeded with a chopped of hand or running through the forest (2 choices at least for both previous outcomes)
Here is a start you can hopefully figure out how to expand on :)
def main():
print("Tristan Aljamaa's Simple Python Choice Game")
print("===========================================")
print("Instructions: Type A) or B) etc. whenever prompted\n")
game()
def game():
Answer = (input("You meet a bear, what do you do?\n A) Give the bear a hug\n B) Run away \nEnter A) or B):"))
if Answer == ("A)"):
print("The bear chopped your hand off!")
player_died()
else:
print("Good choice, but the bear is running after you")
player_ran()
def player_died():
print("You died, the bear eventually ate you...")
Answer = (input("Game Over!\n\nEnter N) for New Game:"))
if Answer == ("N)"):
main()
else:
print("Good Bye!")
def player_ran():
Answer = (input("You find an exit from the forest, what do you do\n A) Exit forest\n B) Run around in forest \nEnter A) or B):"))
if Answer == ("A)"):
print("You exited the forest")
player_crossedRoad()
else:
print("You (although insanly) chose to run around in the forest")
player_stillRunsinForest()
def player_crossedRoad():
print("You get the idea...")
main() #for testing on this online editor use the below line when calling the .py file on your computer
if __name__ == "__main__":main()
Try the game out here