Python: Output a numbered variable every time a function is called? -
i'm using turtle show sorter. have number sorting working fine working on sorting bars. know if there's way assign output of function variable each time called. more specifically, want able assign each separate bar variable, , put bar variables list , sort simultaneously numbers nums. i'm making sense. appreciated.
nums=[30,60,90] ##sorted list draw(): ##draws bar based on height of number in 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() in range(len(nums)): ##draws lines in list draw()
do mean this:
def draw(num): ##draws bar based on height of number in list t.fd(5) t.lt(90) t.fd(num) t.lt(90) t.fd(5) t.lt(90) t.fd(num) t.lt(90) t.pu # typo? t.fd(50) t.pd() nums=[30,60,90] ##sorted list num in nums: draw(num)
if not, please give example of you're trying achieve.
Comments
Post a Comment