We use code to make and build things, including art.

 

Intermediate Python is taught downstairs on Monday and Wednesday mornings. The room has been equipped with a "sticky note" whiteboard, which I use to annotate code shown on a projector. 

Students in this class are already familiar with the fundamental concepts of computer programming (input/output, variables, conditional statements, loops, lists), so we have started the school year with a discussion of object-oriented programming (or OOP). OOP is a programming paradigm that makes it easier and more natural to model real-world objects in code. For our first example, students modeled a talking doll, and one of the more complex examples was to model the hour and minute displays on a digital watch.  



OOP lets coders create variables that stand for real-life objects such as talking dolls and digital watches. These objects can then be given commands to perform various tasks using "dot notation." For example, the following Python program first creates a talking doll and then gives the doll the command to speak:

mrbill = TalkingDoll()
mrbill.speak()

For students who write the correct code for TalkingDoll, the output of this program is "Ohh Nooo!!!"  

We are now working with Python turtle graphics in this class. Most of these students are already familiar with turtle graphics, but we are using turtle graphics as our first example of the OOP concept called "inheritance." Inheritance is the idea of taking a pre-existing object and adding extra methods to it that the original object did not possess. For example, the built-in Python turtle does not understand the command drawPentagon; if you want to draw a pentagon, you have to provide all the low-level moving and turning code. However, students will learn how to create a "better" turtle, which has all the functionality of the original turtle, but which is smart enough to understand additional commands.

Students will have the opportunity to display their artistic talent in this unit, creating pictures such as this:



-Steve Gregg