It only takes a week to become a Python Ninja!

Philippines Summer 2012 Blog

Written by: Oshani Seneviratne

June 27, 2012

We are one sixth the way through our course. Before we started, we gave a quiz to assess our students' technical and entrepreneurial skills, and thereby to gauge our curriculum accordingly. The answers we got for the quiz indicated that most of our students are good programmers. This was very comforting to us because we only have two days of teaching and lab work: we teach every Tuesdays and Thursdays for one and half hours (shared between the technical and entrepreneurial instructors) followed by three hours of lab time. Since we don't have much teaching time, we wanted to dive in to complex things right away, and we couldn't have asked for better students!

However, since none of the students have not programmed in python before, we decided to teach the basics of python on the first day of class. We covered a range of topics in Python: basic syntax, strings, user input, useful data structures such as lists, tuples, dictionaries and functions. This was a lot material for a first day of class, but almost the entire class seem to grasp everything that was covered and were very enthusiastic to learn the language. We gave them four programming exercises to complete during the lab time. The questions were to implement the fibonacci function, the zellers algorithm to output the day of a given date, the rock paper scissors game that takes in user input, and the Caesar cipher to encode a given string using a cyclic cipher.

On the second day of class we covered slightly more advanced topics such as object oriented programming, exceptions, regular expressions and python shortcuts. Everybody was so in awe at how multi-line code fragments in other languages can be written in just a single line of code in Python. I think we got them convinced that python is indeed the language to do rapid application prototyping! We made the lab exercises for the second class a little hard, especially since they have the weekend to complete it. The lab exercises were to draw and animate a wheel across the screen using the graphics library, reuse that wheel to draw and animate a car, implement a class to perform algebraic operations on polynomials,  write regular expressions to validate an email string and to get the weather of Manila from wunderground.com, implement few functions that make use of list comphrehensions and python built-in functions, and to find the number of common tuples in a given dataset. Successful completion of this assignment meant that they can tackle any programming task in Python. We have started grading last week's assignments and we are starting to see lot of emerging stars and python ninjas already!