#!/usr/bin/env python # coding: utf-8 # In[2]: #NOTE: the following code does not run in Jupyter notebook # use the following URL to run code using the turtle package: # https://repl.it/languages/tkinter import turtle import time # make the turtle appear turtle.showturtle() time.sleep(2) # change color of pen to the hex color #6d006a turtle.pencolor("#6d006a") # move turtle forward turtle.forward(30) # print to console the coordinates of the turtle at this moment print(turtle.pos()) time.sleep(2) # this turns turtle 90 degrees right turtle.right(90) time.sleep(2) # change pencolor to red turtle.pencolor("red") turtle.forward(50) time.sleep(2) # this makes turtle point at 135 degrees no matter what direction it is currently pointing turtle.setheading(135) time.sleep(2) turtle.forward(100) print(turtle.pos()) time.sleep(2) # "lift the pen" turtle.penup() # go to a certain coordinates turtle.goto(-50,50) time.sleep(2) # put the pen down to draw again turtle.pendown() turtle.forward(50) time.sleep(5) # In[ ]: import turtle import time turtle.showturtle() turtle.setheading(135) turtle.circle(50,extent=270) time.sleep(2) # pick pen up so it doesn't draw turtle.penup() # move to the top left of the "T" turtle.goto(-140,170) time.sleep(2) # put pen down to draw turtle.pendown() # change pen color to purple turtle.pencolor("#6d006a") # draw the top bar of the "T" turtle.forward(100) time.sleep(2) # move turtle to the middle of the top of the "T" turtle.goto(-90,170) time.sleep(2) # make turtle point south turtle.setheading(270) time.sleep(2) # draw vertical part of "T" turtle.forward(100) time.sleep(2) # lift the pen turtle.penup() # move to start point of the "C" turtle.pencolor("red") turtle.goto(130,-20) # put the pen back down turtle.pendown() time.sleep(2) # set heading to go up and left turtle.setheading(135) time.sleep(2) # make the top right part of the "C" turtle.forward(50) time.sleep(2) # make the next segment turtle.setheading(225) time.sleep(2) turtle.forward(50) time.sleep(2) # vertical part of the left of the "C" turtle.setheading(270) time.sleep(2) turtle.forward(100) time.sleep(2) # left bottom part of the "C" turtle.setheading(315) time.sleep(2) turtle.forward(50) time.sleep(2) # last segment of the "C" turtle.setheading(45) time.sleep(2) turtle.forward(50) time.sleep(5)