python pen.forward code example
Example 1: how to make a screen in turtle
def turtle_triangle():
window = turtle.Screen()
window.bgcolor("red")
brad = turtle.Turtle()
brad.shape("turtle")
brad.color("yellow")
brad.speed(1)
for _ in range(3):
brad.right(60)
brad.forward(200)
brad.right(60)
window.exitonclick()
Example 2: python turtle
from turtle import *
color('red', 'yellow')
begin_fill()
while True:
forward(200)
left(170)
if abs(pos()) < 1:
break
end_fill()
done()