heading turtle python 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: turtle module python
>>> player_one = turtle.Turtle()
>>> player_one.color("green")
>>> player_one.shape("turtle")
>>> player_one.penup()
>>> player_one.goto(-200,100)
>>> player_two = player_one.clone()
>>> player_two.color("blue")
>>> player_two.penup()
>>> player_two.goto(-200,-100)