Prerequisites
This course in computer programming will take place in Michaelmas. The course strongly takes the view that best way to learn how to write computer programs is to sit in front of a computer and to "have a go". Programming is a skill that (like learning to play a musical instrument) is best learned through direct experience, through practice, by learning from one’s mistakes, by attempting to copy and understand examples etc. It is not a skill that can be absorbed simply by sitting in a lecture theatre and listening to a lecturer.
For this reason, the course will mostly be taught through self-guided study in practical classes in which students will either work through examples in the course handout, or modified versions thereof. The self-study part of the course would ordinarily be preceded by two introductory lectures (changed to online videos this year, see course website). The purpose of these lectures is to outline the basics tools required to follow the instructions in the course booklet, and to give a very brief introduction to the concept of computer programming. Students must understand that it is not the lecture course that will teach them how to program. Their most important resources for learning will be the handout, the friends, neighbours, the demonstrators, the other students on the course, book and last and perhaps most significant, on-line reference sources found via google, etc.
Using python
Since 2021/2022 the course material has been changed to use python3 programming language. Anyone attempting to teach themselves to program will benefit strongly from having a Python 3 reference book beside them at all times (see some suggestions below) and an open web-browser in which to look up examples of code, etc.
Students are actively encouraged to discuss what they are doing with others doing the course, to work in pairs or small groups.
Course structure
Two introductory/motivational lectures followed six weeks during which the students will work through the self-study guide. Each assessed piece of work will have a specific programming task.
The aim of the first half of the course is for every student to become familiar with the terminal-based software development environments, a text editor, elementary python programming, and various python extension modules.
In the second half of the course, students will each complete two mini-projects. Each mini-project will consist of a core task which all students will have to complete and optional parts introducing more interesting computational/physics ideas.
Learning Outcomes and Assessment
Assessment
You are required to submit six small pieces of work electronically for assessment.
The course handout suggests a series of investigations for you to tackle, but also explains how they can be varied/altered. The course handout explains how and where to find the links to the upload portal.
Submitting Your Work
Please use Google Forms on
https://forms.gle/TGddTz2pUdu5mtBr
The submission form will ask you to log into Google with your CRSid E-mail address. We will do our best to provide timely feed-back on submitted work during term. Assume that silence means all is well; if you are anxious of have doubts, please contact the lecturer.
Demonstrator Sessions
Synopsis
Programming a Computer: Computer program, software development process, compiled and interpreted languages, C++ and Python
Python for Beginners: Calculator, variables, Hello World!, command line and scripts
Working with Variables:Basic data types, variables and declarations, type conversion, duck typing, arithmetic expressions, working with floating point numbers
Basic Containers: list, tuple, set, dictionary
Programming structures: loops and control statements
Functions, Modules and Packages: built-in and extension modules
Object-Oriented Programming with classes
Advanced topics: working with strings, formatted output, advanced containers, regular expressions, working with text files, working with CSV file format
References
Guido van Rossum and the Python development team:: Python Tutorial, Release 3.7.0, Python Software Foundation, September 02, 2018 https://bugs.python.org/file47781/Tutorial_EDIT.pdf
Anthony Scopatz and Kathryn D. Huff: Effective Computation in Physics, O'Reilly Media, Inc, June~2015 https://www.oreilly.com/library/view/effective-computation-in/9781491901564/
Allen B. Downey: Think Python, O'Reilly Media; 2nd edition, January~2016 https://greenteapress.com/wp/think-python-2e/
Dr Hrvoje Jasak | Coordinator |