Tutor: Dr. Mark Lee

Material for a 6 session course on Introductory Programming in Python aimed at Secondary School teachers. The course was delivered in February 2013 and consisted of six two hour sessions. The emphasis was on writing and playing with code rather than lectures. All code may be freely shared for non-commercial teaching purposes.

Session 1
Session 1 presented a general overview of Python. It started with a short history of Python and how to install Python. Basic data types such as strings, integers and lists are introduced with while & for loops.
Session 2
Session 2 looked in more detail at list processing and string methods. Functions were introduced and the use of recursion.
Session 3
Session 3 used functions and recursion to develop a "user friendly" function for printing arbitarily nested lists. The use of default values was introduced.
Session 4
Session 4 introduced modules which extend the builtin functionality of python. The random was used to generate random variables. The concept of pseudocode was introduced as a method for developing a simple algorithm which then can be implemented in Python.
Session 5
Session 5 was a practical session to implement a simple algorithm called bubblesort. The algorithm was described in English which was then translated into several iterations of ever more efficient code. Included in the code is a version of insertion sort and a recursive implementation of bubblesort. The latter is prone to crash on large lists due to internal restrictions in python which can be changed using the module sys.
Session 6
Session 6 concluded with the use of external files to input and output persistent data. The use of exceptions of recover from runtime and file errors was presented and a new data type, dictionaries, introduced. Finally the inbuilt data storage method Pickle was covered.