I'm trying to recreate a function
spiral() using recursion that takes the parameters
initLen (pixel length of first side),
N (angle connecting segments), and
mult (a float amount indicating how much bigger/smaller each segment should be after each turn - ex:
mult = 0.5 means each segment would be half the length of the previous). The drawing should stop when the segment length reaches less than 1 or greater than 500.
example of desired output for
spiral( 100, 90, 0.9 ):
I have attempted this:
def spiral( initLen, N, mult ): if initLen> 500: return elif initLen< 1: return else: pendown() forward(initLen) left(360.0/N) spiral((initLen*mult),angle, mult)
Thinking the only thing changing is segment length (by order of the multiplier) each turn.
My program output for
spiral( 20, 90, 0.9 ) is....
not quite similar to above...