今天是30天程序语言研究的第十一天,研究的语言一样是python,今天主要学习的是问答程序
笔记:
#question.py
class Question:
def init(self, description, answer):
self.description = description
self.answer = answer
from question import Question #从档案question指引入Question
test = [
"1+3=?\n(a) 2\n(b) 3\n(c) 4\n\n",
"1公尺等於几公分?\n(a) 10\n(b) 100\n(c) 1000\n\n",
"香蕉是什麽颜色?\n(a) 黑色\n(b) 黄色\n(c) 白色\n\n"
]
questions = [
Question(test[0],"c"), #问题表达
Question(test[1],"b"),
Question(test[2],"b")
]
def run_test(questions):
score = 0
for question in questions:
answer = input(question.description)
if answer == question.answer:
score += 1
print("你得到" + str(score) + "分,共" + str(len(questions)) + "题")
run_test(questions)
Microsoft Azure Machine Learning 终於开始罗。 <<前提...
Chap.II Machine Learning 机器学习 https://yourfreetemp...
伫列(Queue)建立的方法 enqueue: 尾端新增元素 dequeue: 从前端移除元素 pe...
昨天我们把 Signaling server 完成了,今天我们要继续完成 Client 端: 细部分...
网址:https://tryhackme.com/room/cyborgt8 IP : 10.10...