I'm using turtle to show a sorter. I have the number sorting working fine but I am working on sorting the bars. I would like to know if there's a way to assign the output of a function to a variable each time it is called. More specifically, I want to be able to assign each separate bar to a variable, and then put all the bar variables into a list and sort it simultaneously with the numbers from nums. Hopefully I'm making sense. Any help would be appreciated.
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()