Course description This course serves as an introduction to computer programming and computer science. We will introduce the Python programming language. We will use Python to solve a variety of problems, and practice problem-solving techniques that are applicable to computational problems. We will discuss good practices in software engineering (designing and building large software systems). We will analyze the efficiency of algorithms, and discuss designing efficient algorithms. Various research areas in computer science (AI, software engineering research, the theory of computation, etc.) will be introduced throughout the term. No previous knowledge of programming or computer science is assumed.
The course syllabus is available here.
Project 1: Gamification. gamify.py. Due Oct. 9 at 10:59 p.m. Submit on Gradescope.
Project 2: Gomoku. gomoku.py. Due Nov. 6 at 10:59p.m.
Project 3: Synonyms using AI. synonyms.py, test.txt. Due Dec. 7 at 10:59p.m..
Labs posted ahead of time are subject to change
Lab 1: Tracing and Conditionals (assigned Sept. 14, show the TA by Sept. 19). Solutions
Lab 2: Local and Global Variables (assigned Sept. 21, show the TA by Sept. 26). Solutions
Lab 3: Multifile projects, Computation Using Loops (assigned Sept. 28, show the TA by Oct. 3). Solutions
Lab 4: Computation Using Loops II (assigned Oct. 5, show the TA by Oct. 10). Solutions
Lab 5: Lists and Lists of Lists (assigned Oct. 12, show the TA by Oct. 17). Solutions
Lab 6: Tic-tac-toe. ttt.py (assigned Oct. 26, show the TA by Oct. 31). Solutions
Lab 7: Gaussian Elimination. Sample run of GE, numpy_arrays.py (assigned Nov. 2, show the TA by Nov. 7). Solutions.
Lab 8: Files and Dictionaries (assigned Nov. 16, show the TA by Nov. 21). Solutions.
Lab 9: Processing Large Text Files (assigned Nov. 23, show the TA by Nov. 28)
Lab 10: Recursion (assigned Nov. 30, show the TA by Dec. 5). Solutions. Video solutions: Iterative is_balanced(), implementing the iterative is_balanced() recursively (and tracing the solution). A genuinely recursive approach (tracing the genuinely recursive approach). A recursive str.find().
The midterm will be held online on Oct. 22. Past midterms are below.
2015 midterm paper. Reference sheet. Solutions: Part 1, Part 2 (contains optional advanced material).
2014 midterm and aid sheet. (Solutions). Note: in Q2d, True and False should switch places. Another solution is to go return not (a==b==c). Not covered yet: Q2(a), Q2(c), Q3(d), the bonus is difficult without more material.
2010 midterm. (Solutions; note that there is a small bug in the solutions to the last question and that the midterm was written in Python 2, which means that it uses print <things-to-print> instead of print(<things-to-print>).)
The exam will be held in December. Past exams are below.
2016 exam paper (reference sheet). Solutions + marking scheme.
2015 exam paper (reference sheet). Partial solution of the challenging problems. I encourage people to work on the problems in the beginning of the exam by themsleves. (Note that Q8 and Q9 were supposed to be very challenging -- exam grades were adjusted.)
2014 exam paper (reference sheet). Solutions and my favourite solution of Q7. Video solution of Q7.
Design credit: CS229, Jan 2019.