University of Helsinki Department of Computer Science

Department of Computer Science

Department information


Programming in Python, Fall 2009 (4 cr), Period I

The course is a voluntary intermediate level course. The teaching is fully in English.



Programming skills in at least one programming language recommended. Basic computer skills (Unix).

Learning targets


Jarkko Toivonen 08.09.-15.10. Tue 12-14, Thu 10-12 B123

Note. On 24th of September the lecture is exceptionally at 8-10 in B123.

Lecture slides

I will add printable handouts later.

Tue 8.9 Administration Basics part 1
Thu 10.9 Basics part 2
Tue 15.9 Basics part 3
Thu 17.9 Basics part 4 Objects part 1
Tue 22.9 Objects part 2
Thu 24.9 Objects part 3 Exceptions
Tue 29.9 Modules File handling, the sys module
Thu 1.10 Strings and regular expressions 1
Tue 6.10 Strings and regular expressions 2
Thu 8.10 Documentation and testing NumPy
Tue 13.10 Tkinter Example program
Thu 15.10 Miscellaneous What's new in Python 3

Four slides per page

Exercise sessions

Note. The exercises will begin already in the first week. First week's exercises will be in a computer class and later exercises in a normal class. Note also the special times on first week in groups 1 and 2.
  1. Lauri Alanko 08.09. Tue 14-16 B221, 14.09.-16.10. Mon 12-14 B119
  2. Lauri Alanko 08.09. Tue 16-18 B221, 14.09.-16.10. Mon 14-16 B119
  3. Markus Heinonen 07.09. Mon 14-16 B221, 14.09.-16.10. Mon 14-16 DK117, This group is reserved for MBI students only!
  4. Markus Heinonen 10.09. Thu 16-18 B221, 14.09.-16.10. Thu 16-18 B222
  5. Harri Hämäläinen 08.09. Tue 18-20 B221, 14.09.-16.10. Tue 18-20 B119
  6. Harri Hämäläinen 11.09. Fri 12-14 B221, 14.09.-16.10. Fri 12-14 B119
  7. Lauri Alanko 10.09. Thu 14-16 B121, 14.09.-16.10. Thu 14-16 CK111
  8. Harri Hämäläinen 08.09. Tue 14-16 DK110, 14.09.-16.10. Tue 14-16 BK107
Exercise questions will be published about a week in advance, except for the first set of exercises, which are ex tempore style. Solve the exercises at home and then go to your exercise group to present your solutions. Solutions returned by e-mail are not accepted, presence at exercise session is required to get any points.
  1. ex-1
  2. ex-2
  3. ex-3
  4. ex-4
  5. ex-5
  6. ex-6
Solutions to exercises and discussion about them can be found here. Requires University's password.

Preliminary contents

Course material

The course book is "Python in a Nutshell" [1]. About a dozen copies have been ordered to the faculty library. Additionally, slides shown during lectures will be published here. See also a separate page on external resources.


Note, the date has changed. Course exam (obligatory) is on Wednesday 21th of October at 9-12 in room B123 Tuesday 20th of October at 16-19 in rooms A111 and B123 of Exactum.

The exam questions will be both in Finnish and in English, and you can use either language to answer. There will be 3 questions. The first question consists of several small questions. The second question will probably be an algorithmic or programming related question. The third question will be a short essay. The questions (especially the first and the third) will be less like the exercise questions; they test more about the understanding of the different aspects of the language.

The exam will cover the lectures and exercises. The Python 3 part of the lectures will not be required.

Project work

This larger obligatory assignment is worth 20 points. The student is expected to implement a program in clear Python code according to style and recommendations learned during the course. The work should be documented and tested according to normal software practices. Topics for the assignment will be given later. Go to the separate project page


Exam 20 points + Project work 20 points + Exercises 20 points = 60 points. Grade 1/5 requires ~30 points, grade 5/5 requires ~50 points. The course cannot be passed by a separate exam.


  1. Alex Martelli, Python in a Nutshell, O'Reilly 2006
  2. Hans Petter Langtangen, Python Scripting for Computational Science, Springer 2009
  3. Mark Pilgrim, Dive Into Python, CreateSpace 2004
  4. Mark Lutz, Learning Python, 3rd Edition , O'Reilly 2008

Jarkko Toivonen