انا اريد تصحيح الكود واريد المساعده فى تعديله

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

يرجى الدخول لحسابك أو تسجيل حساب لتستطيع إضافة تعليق
حساب جديد دخول

التعليقات

لست متخصص في لغة بايثون لكن مبدئيا يمكنك لصق الكود اعلاه من مصدره الاصلي في الموقع ادناه

ثم ادراج الرابط ليتسنى لأصحاب الخبرة مساعدتك في تعديلة

أفضل استعمال هذا الموقع:

ما الخطأ الذي يظهر لكِ، ومُلاحظة بسيطة هل الرِّماز (الكود) أعلاه كامل أم فقط جزء منه؛ لأنكِ تستعملين متغيرات غير معرفة!