我试图在绘制递归平方'k'次后绘制一个螺旋,并获得我想要的输出 -
但是我对螺旋()函数以及如何获得该输出感到困惑。
代码 -
from turtle import Turtle, Screen
import math
def squareinsquare(x, y, side):
square(x, y, side)
half = side / 2
b = math.sqrt(half**2 + half**2)
tiltsquare(x, y - side/2, b)
#squareinsquare(0, 0, 200)
def fractal(x, y, startSide, k):
t.setpos(x, y)
for i in range(k):
square(*t.pos(), startSide)
t.forward(startSide / 2)
t.right(45)
startSide /= math.sqrt(2)
fractal(0, 0, 200, 5)
def spl(x, y, stLength, k):
# YOUR CODE BELOW THIS LINE
s.exitonclick()