pip turtle python code example
Example 1: how to import turtle in python
import turtle # imports it
whateverYouWantToCallIt = turtle.Turtle() # adds it to the project
#code
whateverYouWantToCallIt.forward(10) # moves whateverYouWantToCallIt forward
whateverYouWantToCallIt.color("purple") # color
whateverYouWantToCallIt.left(90) # turns him 90 degrees
whateverYouWantToCallIt.right(90) # turns him 90 degrees the other direction
Example 2: python turtle example
# 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()