import random
import time
name = input("What is your name ?\n")
print("Hello, " + name + ". Let us play an interesting game !!")
def displayIntro():
print("You are in a land full of dragons. In front of")
print("there are two caves. In one cave the dragon is") print("friendly and will give you his treasure. In the") print("other, the dragon is greedy and hungry and will") print("eat you on sight") print()
def choose_cave(): while True: cave = input("which cave will you choose ..") if cave == 1: print("you find the dragon .") else cave == 2: print("this cave will lead you to the outside!")
def checkCave(chosenCave): print("You approach the cave...") time.sleep(2) print("It is dark and spooky...") time.sleep(2) print("A large dragon jumps out in front of you. He opens his jaws and...") print() time.sleep(2) friendlyCave = random.randint(1, 2) if chosenCave == str(friendlyCave): print("gives you his treasure") else : print("gobbles you down in one bite") playAgain = "yes" while True: display_intro() check_cave(choose_cave()) print("Would you like to play again? (yes or no)") if input() not in ('yes', 'y'): break
التعليقات