turtle-graphics

Drawing the turtle module


from turtle import *
color('red', 'yellow')
begin_fill()
while True:
    forward(200)
    left(170)
    if abs(pos()) < 1:
        break
end_fill()
done()

I do not understand this part of the code. if abs(pos()) < 1: what does it mean?


Solution

  • abs(pos()) means absolute position. if abs(pos())<1: means you come back to starting point. Hope it clarifies to you.