,python,loops,for-loop,while-loop"/>

首页 > 解决方案 > 循环不工作,

问题描述

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

标签: pythonloopsfor-loopwhile-loop

解决方案


需要调用该函数:nums()


推荐阅读