American Young Coder

AYC logo
Loading Events

« All Events

  • This event has passed.

7:00 PM- Intro to Python – Joshua

April 23 @ 7:00 pm - 8:00 pm

Today We DID

  • We Learned about
  • An alternative way of drawing. Rather than locations, we can command the turtle to turn left, right and right with
    • turtle.forward(100) (goes 100 steps in the direction of the arrow
    • turtle.left(90) (arrow turns left 90 degrees)
    • turtle.right(90) (arrow turns right 90 degrees)
  • Combining functions to draw more complicated shapes

Homework
So we created the function called rectangle below. Rather than figuring out multiple different turtle .forward, .left, and .right , lets use are new rectangle to draw shapes! as long as the shape can be made with rectangles, we can make it to !

Your mission is to draw the letter E only using the rectangle function. Adjust the x,y,length,width, and color as needed and multiple rectangles to create a capital E.

A secondary goal, is to create the DRAW_E function, which will take an x and a y (and color if you would like) and draw it in that location. You can do it! it is very similar to last weeks homework/lesson.

def rectangle(x,y,length,width, color):

turtle.penup()
turtle.goto(x,y)
turtle.pendown()

turtle.color(color)
turtle.begin_fill()
turtle.forward(width)
turtle.left(90)
turtle.forward(length)
turtle.left(90)
turtle.forward(width)
turtle.left(90)
turtle.forward(length)
turtle.left(90) # we need reset the arrow
turtle.end_fill()

rectangle(-100,0,200,75,”red”)

 

Details

Date:
April 23
Time:
7:00 pm - 8:00 pm