python install turtle 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: how to import turtle in python

import turtle

Example 3: python turtle tutorial

>>> turtle.heading()
22.0
>>> turtle.right(45)
>>> turtle.heading()
337.0