American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

7 PM – Intro To Python – Darin

July 16 @ 7:00 pm - 8:00 pm

What We Did Today:

  1. Learnt how to combine multiple shapes into one function in turtle

Homework:

    1.  Create a file called July16_AdvancedTurtleHW.py and convert the following code into a function that can be used to draw the shape at any coordinates:
import turtle as t

t.bgcolor("lightblue")
t.speed("fastest")

def draw_rectangle(x, y, length, height, pen_color):
# sets color
t.color(pen_color)

# this moves location
t.penup()
t.goto(x, y)
t.pendown()

t.begin_fill()
# this draws the shape
for i in range(2):
t.forward(length) # draws length
t.right(90)
t.forward(height) # draws height
t.right(90)
t.end_fill()

draw_rectangle(0, 0, 100, 20, "black")
draw_rectangle(0, 50, 10, 100, "red")
draw_rectangle(90, 50, 10, 100, "red")

def make_shape(x, y):
# to make
# to make

Here is what the image looks like:

NOTES:

If you have any questions, you can contact me at ddjapri@ayclogic.com

 

Details

Date:
July 16
Time:
7:00 pm - 8:00 pm
Event Categories:
,
Verified by MonsterInsights