无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

這是一個(gè)問答游戲源代碼(自己寫的)請(qǐng)?jiān)趐ython中用)

2023-06-30 17:37 作者:劉某某pp  | 我要投稿

def ask_question(question, answer):

? ? user_answer = input(question + " ")

? ? if user_answer.lower() == answer.lower():

? ? ? ? print("回答正確!\n")

? ? ? ? return True

? ? else:

? ? ? ? print("回答錯(cuò)誤!\n")

? ? ? ? return False

def main():

? ? questions = [

? ? ? ? {

? ? ? ? ? ? "question": "1 + 1 = ?",

? ? ? ? ? ? "answer": "2"

? ? ? ? },

? ? ? ? {

? ? ? ? ? ? "question": "首都是哪里?",

? ? ? ? ? ? "answer": "北京"

? ? ? ? },

? ? ? ? {

? ? ? ? ? ? "question": "世界上最高的山是哪座山?",

? ? ? ? ? ? "answer": "珠穆朗瑪峰"

? ? ? ? }

? ? ]

? ? print("歡迎來到答題游戲!")

? ? score = 0

? ? for q in questions:

? ? ? ? question_text = q["question"]

? ? ? ? correct_answer = q["answer"]

? ? ? ? result = ask_question(question_text, correct_answer)

? ? ? ? if result:

? ? ? ? ? ? score += 1

? ? print(f"游戲結(jié)束!您的得分是:{score}/{len(questions)}")

if __name__ == "__main__":

? ? main()


這是一個(gè)問答游戲源代碼(自己寫的)請(qǐng)?jiān)趐ython中用)的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
墨竹工卡县| 五台县| 咸宁市| 竹北市| 武宣县| 浮山县| 枣强县| 会理县| 临江市| 彰化县| 西畴县| 宁安市| 江门市| 东阿县| 宝鸡市| 乐都县| 通河县| 长宁区| 新河县| 城步| 嘉峪关市| 阿拉善盟| 辉县市| 克拉玛依市| 玛纳斯县| 石嘴山市| 松原市| 邯郸市| 游戏| 永福县| 南岸区| 河间市| 鄂伦春自治旗| 东丰县| 健康| 泾川县| 化州市| 开封县| 灌阳县| 黄冈市| 化德县|