Skip to content

Commit 3efd623

Browse files
miss-islingtonm-aciekStanFromIreland
authored
[3.14] Docs: simplify turtle tutorial's star example code (GH-155232) (#155563)
(cherry picked from commit 7c072c1) Co-authored-by: Maciej Olko <maciej.olko@affirm.com> Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent 329dab6 commit 3efd623

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

Doc/library/turtle.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,16 @@ filling can be turned on and off::
166166

167167
Next we'll create a loop::
168168

169+
start = pos()
170+
169171
while True:
170172
forward(200)
171173
left(170)
172-
if abs(pos()) < 1:
174+
if distance(start) < 1:
173175
break
174176

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

178180
Finally, complete the filling::
179181

0 commit comments

Comments
 (0)