python - 如何从单词列表中选择python中的随机单词
问题描述
这是我的代码:
rightPath = random.choice(North,East,South,West)
if selectPath == rightPath:
print("You slay the monsterous beast and proceed further into the castle")
print("This is just the start of your dangerous adventure")
else:
print("The Monster attacks leaving you helpless on the floor")
time.sleep(4)
print("You Died")
我想让它从北、东、南、西列表中选择一个随机方向。
解决方案
推荐阅读
- vb.net - 如何将事件处理程序移动到父表单并传递 eventargs
- python - Python prgram 重命名后不会构建
- javascript - 如何创建一个 foreach 循环以将音节放置在其各自单词的每个输入中
- java - 将带有连接的 SQL 查询转换为 JPA
- r - R中3小时内的平均数据(按前一小时和下一小时计算)
- android - 如何以编程方式从有根设备上的本地数据库获取 WhatsApp 消息?
- python - PyQt listView复选框在选中/未选中时连接
- webserver - Airflow:`airflow webserver`、`airflow scheduler` 和 `airflow worker` 到底是做什么的?
- c++ - 在 z3::expr 中使用 C++ 字符串?
- c# - ASP.NET MVC ViewModel 与模型验证