- This event has passed.
7 PM – Intro To Python – Darin
July 30, 2025 @ 7:00 pm - 8:00 pm
What We Did Today:
- Finished a robot drawing using python and geometry
- Learnt how to use different shapes to form a function for a drawing
Homework:
- Draw something with at least 4 rectangles WITHOUT a function
- make sure the first rectangle is at (0, 0) for starting point
- Transform this drawing into a function, as shown above.
- The trick is to replace the first rectangles starting point with (x, y)
- and for every other rectangle, you add the x and y in front of it for starting point
So something like this:
# head makeRectangle(0, 0, "red", 80, 50) # eyes makeRectangle(25, -10, "white", 30, 10) makeRectangle(30, -15, "black", 5, 5) makeRectangle(40, -15, "black", 5, 5) # mouth makeRectangle(20, -35, "black", 30, 5)
ABOVE TRANSFORMS INTO:
def makeHead(x, y, color): # head makeRectangle(x, y, color, 80, 50) # eyes makeRectangle(x+25, y-10, "white", 30, 10) makeRectangle(x+30, y-15, "black", 5, 5) makeRectangle(x+40, y-15, "black", 5, 5) # mouth makeRectangle(x+20, y-35, "black", 30, 5) makeHead(200, 200, "red") makeHead(-200, -200, "yellow")
Notes:
You can reach me at ddjapri@ayclogic.com for any questions.
Class notes: https://drive.google.com/drive/folders/1JIaswYI_MssVSv7icxgYPd_LblYQvOVO?usp=sharing