0
我使用龟来显示分拣机。我有号码排序工作正常,但我正在分拣酒吧。我想知道是否有办法在每次调用函数时将函数的输出分配给变量。更具体地说,我希望能够将每个单独的栏分配给一个变量,然后将所有栏变量放入列表中,并将其与nums中的数字同时排序。希望我有道理。任何帮助,将不胜感激。Python:每次调用函数时都输出一个编号变量?
nums=[30,60,90] ##sorted list
draw(): ##draws the bar based on height of number in the list
t.fd(5)
t.lt(90)
t.fd(nums[i])
t.lt(90)
t.fd(5)
t.lt(90)
t.fd(nums[i])
t.lt(90)
t.pu()
t.fd(50)
t.pd()
for i in range(len(nums)): ##draws all lines in the list
draw()