This course is a short introduction to the Python programming language. Our first lecture is Monday April 24 at 11:30 in SW3-1710. Labs will start the first week (Monday) in SW1-2560.
There have been changes to the scheduling of the Set 4L and 4S labs to ensure each set has one lab following each lecture. Please see the on-line timetable for the current schedule.
In particular, the Wednesday 8:30 lab has been moved to Thursday and the other Thursday lab shifted.
There will likely be additional changes to the times of the Thursday labs for the next week or two. These will be announced in class and on the course web site.
Starting Thursday May 4 (next week) Set 4S will have their Thursday labs at 8:30. This change may not show up on your on-line timetables.
For Lab 2, there is a bit more information that we weren't able to cover in the lectures that you'll need to know for the lab.
Please read about it ahead of time and Dave will talk about it for a few minutes during the lab if there are still questions.
From: "A Whirlwind Tour of Python" pages 43-45 in the PDF version (or notebook "08-Defining-Functions.ipynb" in the notebook version):
As an exercise in finding and learning to use Python packages on your own, you must prepare a 5- or 10-minute presentation on a Python package of your choice (5 minutes if presenting by yourself, 10 if in groups of two). The presentations will be made to the other students in your lab set during your scheduled lab on May 15 or 16. You may choose a standard library package that has not been used in the course or you can pick one of the many packages available from the Python Package index: https://pypi.python.org/pypi
To avoid duplication and to make sure the package can be reasonably presented in the time allotted, during your lab on May 10-12 you must inform your lab instructor of the package you will be presenting.
You may use your own laptop or the instructor's workstation for your presentation. If the latter, tell the instructor if you need package(s) installed for your presentation.
Presentations should be submitted as Jupyter notebooks with marked-up text and executable code. They should be submitted to the appropriate dropbox before your presentation and include:
After your presentation the class (or the instructor) will ask you a question or two about the package.
Time your presentation beforehand and make sure you do not exceed your time limit.
The presentation will be marked as follows:
Each lab is marked out of 1 (1 if all checks pass, 0 if any fail).
Each optional mark question in Labs 1 to 5 will count as a bonus of 0.25 of a lab. Fractional marks will be truncated.
The final lab mark (worth 40% of the final mark) will be computed as:
40% * floor( sum(labmark[0:6]) + 0.25*sum(labmark[0:5] )/6
In other words, if you completed four bonus questions can make up for one failed lab.
There are dozens of built-in packages, most of which we have not covered in the lecture or labs. See the Python library reference.
There are over a hundred packages included in the default Anaconda installation (e.g. on the lab PCs) and hundreds more easily installed using the Anaconda Navigator interface. See the Anaconda package list.
There are thousands of packages that can be easily installed from the Python Package Index (PyPI) using the pip command-line utility. See the PyPI web site.
Or use your favourite search engine to search for "python package for X" where X is some topic of interest to you.
For the optional question in Lab 5, you should use the .close() or .flush() method on the file after you're finished writing to it. This will allow the testing code to read your file contents correctly.
Lab 1 - Basic Syntax
Lab 2 - Container Classes and Functions
Lab 3 - packages and exceptions
Lab 4 - iterators, generators and list comprehensions
Lab 5 - File I/O and Regular Expressions
Lab 6 - Numpy
The marking code for Lab 5 behaved differently on Unix (including Mac) and Windows systems. A new version (version 3) with marking code that works on both is available. If you had a problem with Lab 5 marking you can copy the new marking code cell into your notebook. The submission deadline has been extended to Friday, May 19.
All marks have been entered. The distribution of the unofficial final marks is as follows:
The final exams and solutions have been posted in notebook and HTML formats under Content / Exams.
Please check your marks (see course information handout for instructions) and let me know if you have any questions.