Skip to content

Commit e987990

Browse files
miss-islingtonm-aciekStanFromIreland
authored
[3.13] Docs: simplify turtle tutorial's star example code (GH-155232) (#155562)
Co-authored-by: Maciej Olko <maciej.olko@affirm.com> Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent 9622dec commit e987990

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
@@ -159,14 +159,16 @@ filling can be turned on and off::
159159

160160
Next we'll create a loop::
161161

162+
start = pos()
163+
162164
while True:
163165
forward(200)
164166
left(170)
165-
if abs(pos()) < 1:
167+
if distance(start) < 1:
166168
break
167169

168-
``abs(pos()) < 1`` is a good way to know when the turtle is back at its
169-
home position.
170+
``distance(start) < 1`` is a good way to know when the turtle is back at its
171+
start position.
170172

171173
Finally, complete the filling::
172174

0 commit comments

Comments
 (0)