This month I have been working with one of our technology superstars in the mathematics department to see if we could enhance a preexisting unit on angles by introducing the students to the Turtle library in Python. Each lesson would begin with a structured introduction to the math, followed by either an introduction to new Turtle commands or a deconstruction of an existing Turtle program and finally a challenge that required students to draw a word, shape or pattern. For building the challenges we are using Repl.It
The students took to the code a lot faster than we expected, which I think is a credit to the work being done in our primary school. The students already have three years of block based coding experience under their belt and my general impression from time spent within classes was that the students were very well prepared for transitioning to typed code.
To celebrate our students successes and the approach of the winter holidays, we challenged students to create some festive art using the knowledge and skills they have learned throughout the unit so far. The code for the christmas tree drawing shown above was shared with the students and deconstructed to introduce the functions in Python Turtle and to revisit the idea of a loop.
The tree could be broken down into the following four parts, each of which allowed us to discuss a little math, and a little syntax in Python Turtle:
- The tree trunk – This was a simple square drawn once; it allowed us to remind students of the use of loops in Python Turtle.
- The green triangle – This was defined as a function and called three times. It was the most complex block of code as it involved writing a function that called a loop and used the correct exterior angles for an equilateral triangle (See code below)
- The star – This was an interesting block of code because it involved looping five times and again turning the value of an exterior angle for a five point star. I was happy to be teaching alongside a mathematics teacher when introducing this shape!
- The baubles – These were a single function to draw and fill a circle, that was called at random locations around the tree.