Skip to content

Commit 46ab1ee

Browse files
committed
Docs: simplify turtle tutorial's star example code
distance(start) should be easier to understand than counting the length of a vector
1 parent 7763c98 commit 46ab1ee

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Doc/library/turtle.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,15 @@ filling can be turned on and off::
167167

168168
Next we'll create a loop::
169169

170+
start = pos()
171+
170172
while True:
171173
forward(200)
172174
left(170)
173-
if abs(pos()) < 1:
175+
if distance(start) < 1:
174176
break
175177

176-
``abs(pos()) < 1`` is a good way to know when the turtle is back at its
178+
``distance(start) < 1`` is a good way to know when the turtle is back at its
177179
home position.
178180

179181
Finally, complete the filling::

0 commit comments

Comments
 (0)