python - Python Lotto 模拟随机错误发生
问题描述
我为一个学校项目做了一个 python 乐透模拟。我终于完成了它并且它可以工作,只是当用户要求计算机生成数字时发生随机错误。如果您尝试代码并在按“1”让计算机生成后继续重新启动程序,您将遇到相同的错误。我只是想要一些帮助来解决这个错误,也许还有我可以对代码进行的调整。
谢谢
错误:
Traceback (most recent call last):
File "D:\Lotto\combined.py", line 154, in <module>
start()
File "D:\Lotto\combined.py", line 148, in start
computer_generates()
File "D:\Lotto\combined.py", line 83, in computer_generates
list_of_Num_2[-1].append(x) #Loop and take the first number in list [-1] and add to list
AttributeError: 'int' object has no attribute 'append'
解决方案
推荐阅读
- python - 数据透视表中的计算问题
- node.js - 构建具有多个数据库支持的 Node.js REST API 应用程序的最佳实践是什么?
- mysql - 使用 vb.net 将数据库列存储到按钮上的数组
- sparql - 如何在 Wikidata 中获取非英语语言的标签性别
- c - Creating n children each with their own pipe
- ios - SceneKit,缩放相机以适应节点
- python - Dockerized Flask App - 带有持续运行脚本的 Rest API
- php - PHP count():参数必须是数组或者实现了Countable的对象
- r - 将多个图像加载到 R 中进行操作
- elixir - 使用 Ecto/Elixir 锁定行“FOR UPDATE OF”特定表