xiaohuamao
0
Q:

python turtle example

import turtle
#making the turtle
t = turtle.Turtle()
#commands
t.forward(10)
t.colour('green')
t.left(90)
t.penup()
t.goto(0,0)
t.pendown()
for i in range(45): #circle
  t.forward(1)
  t.right(8)
for i in range(3): #Triangle
  t.forward(10)
  t.left(135)
1
# Step 1: Make all the "turtle" commands available to us.
import turtle

# Step 2: Create a new turtle. We'll call it "bob"
bob = turtle.Turtle()

# Step 3: Move in the direction Bob's facing for 50 pixels
bob.forward(50)

# Step 4: We're done!
turtle.done()
3
from turtle import *
color('red', 'yellow')
begin_fill()
while True:
    forward(200)
    left(170)
    if abs(pos()) < 1:
        break
end_fill()
done()
4

New to Communities?

Join the community