python - 循环不工作,
问题描述
import random
Grades = ["A*", "A", "B", "C", "D", "U"]
def numz():
for x in range(0,20):
print(x)
counter = 0
a = True
while a is True:
print("candidate" ,numz, ":" , random.choice(Grades) , random.choice(Grades) , random.choice(Grades))
counter = counter + 1
if counter == 20:
a = False
打印是候选<function numz at 0x7fa66078bbf8>:A* BD
候选<function numz at 0x7fa66078bbf8>:BUU
解决方案
需要调用该函数:nums()
推荐阅读
- android - 安卓偏好错误??回收站视图?
- python - 使用 Python selenium 选择一个选项
- ubuntu - 无法在浏览器上访问 NGINX 媒体文件夹。得到 404 未找到错误
- python - 将具有不同列和行的两个 Pandas 数据框合并为一个
- python - table=None 但表确实存在
- python - 从 Python 脚本传递和接收数据
- powershell - Powershell Pester 单元测试无法模拟 Expand-Archive
- javascript - 在 Express 的上下文中,“静态”和“非静态”是什么意思?
- sql - 使用带有存在运算符的 SQL 相关子查询
- android - 使用 LiveData 观察片段内的网络变化