We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2ab650e commit d70d57aCopy full SHA for d70d57a
examples/turtle_koch.py
@@ -8,22 +8,23 @@
8
9
10
def f(side_length, depth, generation):
11
- if depth != 0:
12
- side = lambda: f(side_length / 3, depth - 1, generation + 1)
13
- side()
14
- turtle.left(60)
15
16
- turtle.right(120)
17
18
19
+ if depth == 0:
+ turtle.forward(side_length)
+ return
+ side = lambda: f(side_length / 3, depth - 1, generation + 1)
+ side()
+ turtle.left(60)
+ turtle.right(120)
20
21
22
23
24
turtle = turtle(board.DISPLAY)
25
26
unit = min(board.DISPLAY.width / 3, board.DISPLAY.height / 4)
27
top_len = unit * 3
-print(top_len)
28
turtle.penup()
29
turtle.goto(-1.5 * unit, unit)
30
turtle.pendown()
0 commit comments