Programming for the Cognitive and Information Sciences

Spring 2013

General information

Room: Lindley Hall LH 030
: Monday and Wednesday 2:30pm - 3:45pm
Laboratory: Friday 2:30pm - 3:45pm

Instructor: Eduardo Izquierdo
Office: Eigenmann Hall EG841
Email: (include "Q260" in the subject line)
Office hours: By appointment. Or Monday and Wednesday 4pm - 5pm

Assistant instructor: Wren Thornton
Office: Eigenmann Hall EG807
Email: (include "Q260" in the subject line)
Office hours: By appointment.

Course description

This course is designed to refine your computer programming skills and acquaint you with applications of programming in cognitive science. You will learn to write simple computer programs. Programming assignments will focus on developing the fundamentals of your programming skills. When appropriate, assignments will focus on the implementation of models from cognitive science. The goal of the course is to increase your skills and confidence in problem solving using programming.


Main text: Think Python: How to Think Like a Computer Scientist (download pdf) [TP]

Python Programming [PP]

The Python Tutorial [PT]


Date Topic Assignments and Required readings
Week 1
Mon 7 Jan

Goals of the course; Administrative details; Thinking like a computer scientist; What is a program? First program.

Homework 1

Required reading: Ch. 1

Random link: Unix tutorial. Terminal tutorial.

Wed 9 Jan Languages, debugging, data types, operators, variables, comments, importing libraries, and creating your own functions.

TP: Ch. 2, Ch. 3

Random link: BrainPickings

Fri 11 Jan



Week 2
Mon 14 Jan

Flow control: Conditionals (if statements)

Homework 1 due
Homework 2

Required reading: Ch. 5 (through section 5.7)

Random link: PLoS Ten Simple Rules

Wed 16 Jan

Flow control: Iteration (while loops and for loops). Exaustive enumeration algorithms. Data structures: Lists.

Required reading: Ch. 7, Ch. 10

Fri 18 Jan


Random link: KhanAcademy: For loops, While loops, Lists (thanks Keeley).

Week 3
Mon 21 Jan

"The function of education is to teach one to think intensively and to think critically." -MLK

No class.
Homework 2 due
Homework 3

Wed 23 Jan

Recapitulation of programming basics learned so far. Review of homework 2 (loops and lists).

Make sure you have read: Ch. 1, Ch. 2, Ch. 3, Ch. 5 (through section 5.7), Ch. 7, Ch. 10.

Random link: Project Euler

Fri 25 Jan


Online help: Nettuts+: Lessons 1, 2, and 3, and TheNewBoston.

Code used in class: filter(), foldl().

Week 4
Mon 28 Jan

Data structures: Strings

Homework 3 due
Homework 4 (words.txt, text.txt)

Required reading: Ch. 8

Wed 30 Jan File input and output. Dictionaries.

Required reading: Ch. 11 and Ch. 14

Fri 1 Feb



Week 5
Mon 4 Feb

Homework review (30mins). Practice exam (30mins).

Homework 4 due
Homework 5

Practice exam will cover Ch. 1, Ch. 2, Ch. 3, Ch. 5 (through section 5.7), Ch. 7, Ch. 8, Ch. 10, Ch. 11.

Wed 6 Feb

Recursion and turtle graphics (part 1).

Required readings: PSADS: Recursion, Ch. 5 (from 5.8 onwards), Ch. 6 (from 6.5 onwards)

Fri 8 Feb

Walk through practice exam, and visualize the solution to the tower of hanoi.


Week 6
Mon 11 Feb

Recursion and turtle graphics (part 2): Drawing trees.

Homework 5 due
Homework 6

Turtle graphics documentation. Basic turtle tutorial.

Required readings: PSADS: Recursion, Ch. 5 (from 5.8 onwards), Ch. 6 (from 6.5 onwards)

Wed 13 Feb Homework 5 review. Drunk baby turtles. And custom data structures using lists or dictionaries.


Fri 15 Feb



Week 7
Mon 18 Feb

Object-oriented programming (part 1).

Homework 6 due
Homework 7

Useful intro to OOP: Nettuts

TP: Ch. 15, Ch. 16, Ch. 17, Ch. 18

Wed 20 Feb

Object-oriented programming (part 2).


Fri 22 Feb



Week 8
Mon 25 Feb


Wed 27 Feb All day office hours for review Homework 7 due

Fri 1 Mar


See website for Q320.


Class policies

You are expected to attend and participate.

Sessions will begin with a presentation of the topic. You are expected to have done the readings for that week and participate in a discussion of the topic. The lecture and discussion will include computer demonstrations. The rest of the time will be used to work together through additional problems on the topic.

If you are working on your own machine, you may need to install Python (Python comes pre-installed on Mac OS X). We will be using the standard Python software, available here. You should download and install version 2.7.3.

Weekly assignments
There will be assignments given weekly. The assignments will be further developments of the topics covered that week in the class.

You are welcome to collaborate on assignments with your peers. Each of you must turn in your own assignment. You should state in your report who you collaborated with and what each of your contributions were. If you have problems with the homework, seek help.

Hand-in procedure
Assignments will be handed via Email. Make sure to follow each of the following rules:

  1. The email must be sent to both the AI and the Instructor. The subject of the email must be "Q260 H#" where # is the assignment number. For example, the subject line for the first homework should be: Q260 H1. Click here for an example.
  2. Text explanations, when necessary, should be sent in either the body of the email or as an attached Word or PDF document.
  3. Code for each of the individual solutions must be attached in the email. Name each of the files with the individual solutions with your student ID, followed by the homework number, followed by the solution number. For example, the name of my Python file for solution to the second problem in the first homework will be:
  4. At the start of each Python file, in a comment, write down:
    • The identification of the problem (# Homework 1, Solution 2).
    • Your name (#Name: Ross Ashby).
    • The number of hours (roughly) you spent on the problems in that part (#Time: 1h30mins).
    • The names of the people you collaborated with (#Collaborators: Norbert Wiener) and any details about the collaboration.
    • See this file as an example.

Assignment grading
Assignments will be graded based on the following criteria. Note that code that does not run (i.e., invalid syntax) will receive 0 points.

  1. Implementation of the appropriate algorithm, appropriate use of data structures and tools of flow control (50%).
  2. Programming style: sensible use of variable names, function definitions, and well-commented code (25%).
  3. Code produces and outputs the correct solution (25%).

Late work
Assignments get 10% deducted automatically for each day that it is handed in late.

Overall grading
10% Participation
70% Assignments (10% each)
20% Exam

Late work
Assignments get 10% deducted automatically for each day that it is late.


Supplementary material

Although not officially assigned for the course, the books and research articles here address many of the topics that we will discuss in further depth.