Tuesday, March 17, 2020

Turtle Graphics in Python




# It turns out that it's really easy to have a turtle that draws in Python.
# For example, the program below draws the star above:

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

# For drawing the image below, you will have to work a little harder :)



No comments:

Post a Comment