【发布时间】:2022-01-25 06:45:40
【问题描述】:
我刚开始学习如何编码(在 python 中),我想知道如何在没有答案的情况下随机提问?
例如,我希望机器人问“法国的首都是哪里?”但没有说“巴黎”?
questions = [("法国的首都是什么?", "巴黎"), ("谁画了蒙娜丽莎?", "达芬奇")]
泰:)
【问题讨论】:
-
可能改成
{What's the capital of France?": "Paris", "Who painted the Mona Lisa?":"Da Vinci"},然后做类似这样的random.random(questions.keys())
标签: python string discord tuples