Making with Code

Review: Turtle Drawing #

Welcome to CS10! We hope you’re excited for what we have planned this year! πŸ˜„

Let’s review by taking it back to CS9 Turtle drawings!


[0] Set up #

🌐 Github Repo: github.com/Making-with-Code/lab_turtle_review

πŸ’» cd into the lab

cd lab_turtle_review_yourgithubusername
πŸ‘Ύ πŸ’¬ Windows Users

We suggest not copying the path command, and instead using cd and ls to ensure you are in the correct making_with_code folder.

πŸ’» Install Tkinter We’ll need this for our drawings.

brew install python-tk

πŸ’» Enter the Poetry Shell. Remember, we run this command at the start of each lab, but only when we are inside a lab folder.

poetry shell
πŸ‘Ύ πŸ’¬ Exiting the poetry shell

When you want to exit the shell, you can type exit or ^D


[1] Create a Turtle Drawing #

πŸ’» Using the starter code in turtle_drawing.py create a drawing that includes at least 3 of CS concepts below:

  • Variables
  • Loops
  • Conditionals
  • Lists
  • Dictionaries
  • Functions with parameters

A Few Helpful Functions #

Function Input Example Use Explanation
forward amount forward(100) Moves the turtle forward by the specified amount
backward amount backward(100) Moves the turtle backward by the specified amount
right angle in degrees right(45) Turns the turtle clockwise by the specified angle
left angle in degress left(45) Turns the turtle counter clockwise by the specified angle
color colorname color('red') Sets the color for drawing. Use “red”, “black”, etc. Here’s a list of all the colors.
speed number from 0-10 speed(0) Determines the speed at which the turtle moves around the window. 1 for slowest, 3 for normal speed, 10 for fast, 0 for fastest.
pendown None pendown() Puts down the turtle/pen so that it draws when it moves
penup None penup() Picks up the turtle/pen so that it doesn’t draw when it moves
pensize width pensize(4) Sets the width of the pen for drawing
setheading angle setheading(90) Sets the pen to the 0th degree
circle size circle(10) Sets the radius of the circle
goto x, y goto(90,0) Moves turtle to a given coordinate
begin_fill None begin_fill() Marks the start of the color fill
end_fill None end_fill() Marks the end of the color fill
fillcolor colorname fillcolor('purple') Sets the color of the fill

[2] Deliverables #

⚑✨

πŸ€” Remember, at the end of each class we push to Github

πŸ’» Push your work to Github:

  • git status
  • git add -A
  • git status
  • git commit -m “describe your drawing and your process here”

    be sure to customize this message, do not copy and paste this line

  • git push