国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(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)遵守國家法律
信丰县| 舞钢市| 内乡县| 新平| 长治市| 金华市| 霍林郭勒市| 定远县| 阿城市| 都兰县| 连平县| 江门市| 鹤峰县| 枣庄市| 北京市| 绥宁县| 宁阳县| 高淳县| 临洮县| 民县| 龙游县| 靖远县| 巢湖市| 祁连县| 长汀县| 香格里拉县| 遂川县| 安顺市| 闻喜县| 叙永县| 澎湖县| 高淳县| 太仆寺旗| 桂林市| 梅河口市| 东辽县| 永顺县| 平遥县| 盐津县| 西和县| 镇远县|