Introduction to Computers and Programming
  Spring 2011
Adam Meyers
Research Assistant Professor &
Visiting Clinical Associate Professor

General Information:

Time and Place

(April 7, 2011 venue in 3rd column)

Warren Weaver Hall
251 Mercer Street
Room 109
Tuesdays & Thursdays

January 25, 2011 to April 5, 2011 and
April 12, 2011 to May 5, 2011 (excluding holidays)

Final exam: May 17, 2011, 2:00-3:50PM

Kimmel Hall
60 Washington Square South
Room 909

April 7, 2011 Only
(Due to Special Event in WWH)

Instructor Contact Info

715 Broadway, Room 702
meyers at cs dot nyu dot edu
212 998 3482

Instructor Office Hours

Tuesday and Thursday 11:00AM--12:00PM
Wednesday 9:00AM--10:00AM
or by appointment

Required Text Book

Visual Quickstart Guide to Python
Tony Donaldson
Peachpit Press, 2009
ISBN-10: 0321585445
ISBN-13: 978-0321585448

Optional Text Book

Python Programming: An Introduction to Computer Science (Second Edition)
John M. Zelle, Ph.D.
Franklyn, Beedle & Associates, 2010
ISBN 1-887902-99-6

Course Description and Syllabus: This course introduces computer programming using the language Python 3 as a vehicle. The course will cover basic definitions (what is hardware, what is software, etc.), basics of planning programs (flow charts, psuedo-code, algorithm design), variables (initialization, assignment, scope), operators (+, -, ==), control structures (if, else, elif), iteration (using loops), functions, modules, sequences (lists, strings), among other topics (time permitting). While students will learn how to implement these concepts using Python, general principles will be taught which apply to all modern programming languages.

Prerequisites: Anyone interested and willing to learn about computer science and programming can take this class. However, some proficiency in High School math (algebra, geometry) is assumed. As with any mathematically oriented class, the concepts learned build on each other and it is not advisable to join the class late in the term (beyond the first week). This class is also a prerequisite for V22.0101.

Previous Class Website: For more information, please examine websites from previous classes, such as  V22.0002.005 (Fall, 2010). The current lectures and class structure may be similar, but will not be identical to what is indicated on this previous class website.

Test Dates: There will be two midterms and one final. The dates of these tests are given below.  Please make a careful note of these times in order to prevent scheduling conflicts.


Date and Time

Sample Problems


Midterm 1

February 24, 2011, 2:00-3:15, WWH, Room 109
March 1, 2011, 2:00-3:15, , WWH, Room 109
[Date Change]

Sample Midterm
Sample Midterm Solutions (a .py file)

Grade Curve

Midterm 2

April 12, 2011, 2:00-3:15, WWH, Room 109

Sample Midterm
Solution/Sample Answers as python files:
a) turtle questions; b) non-turtle examples

Turtle Answer
Other Answers
Grade Curve


May 17, 2011, 2:00-3:50, WWH Room 109

Homework: Read the Donaldson book over the course of the semester and do the assigned programming assignments as the term progresses. This section will be continually updated as the term progresses. Grades on homework contribute 25% to the final grade for the course.

Assignment 1

Due February 1, 2011

Assignment 2

Due February 10, 2011

Assignment 3

February 17, 2011 * recommended (to get early grader comments to prepare for Midterm)
Due February 22, 2011 * OK because of Snow Day

Assignment 4

March 10, 2011

Assignment 5

March 24, 2011

Assignment 6

March 31, 2011

Assignment 7

Due April 7, 2011

Assignment 8

Due April 19, 2011

Assignment 9

Due April 26, 2011

Assignment 10

Due May 3, 2011

Extra Credit (optional)

Due May 3, 2011

Materials from Class:

Class 1

Administrative Matters Talk

Introduction to Introduction to CS Talk

Classes 2,3

Installation Issues, etc.

First Python Talk (Print statements, Data Types, etc.)

How Computers Work:
Go to Course Documents
on Blackboard Page

Idle Output Class 2

Idle Output
Class 3

Class 4

In Class Exercises (including in-class solution of date problem)

Idle Output Class 4

Class 5 & 6

Identifiers: functions and variables

Idle Output Class 5
Idle Output Class 6

Class 6, 7 & 8

In Class Exercises

Idle Output Class 6
Idle Output Class 7
Idle Output Class 8

Python Script with answers to exercises

Class 8 & 9

Midterm Review

Sample Midterm
Sample Midterm Solutions (a .py file)

Idle Output Class 8 (repeated)
Idle Output Class 9

Magnify Program, written in class (python Script)

Class 10

Midterm # 1

Class 11

Review Midterm # 1



Class 9 & 11

Modules & Scripts (and turtles)

Idle Output Class 9 (repeated)
Idle Output Class 11

Class 12 & 13

Flow of Control
(If, Boolean, etc.)

Idle Output Class 12
Idle Output Class 13

Class 13 & 14


Idle Output Class 13 (repeated)
Idle Output Class 14

Class 15, 16 & 17


Idle Output Class 15
Idle Output Class 16
Idle Output Class 17

Program for converting number words to numbers. There are two versions: (a) (in class version); and (b) Corrected version (includes Chinese Number Character Program)

Class 17

String Manipulation

Idle Output Class 17 (repeated)

Class 18 & 19

Midterm 2 Review

Idle Output Class 18
Idle Output Class 19

Sample Midterm
Sample Midterm Solutions: a) turtle questions; b) non-turtle examples

Class 20

Midterm 2

Class 21

Review Midterm 2

Idle Output Class 21

Turtle Answer 
Other Answers

Class 19, 21, 22, 23


Idle Output Class 19 (repeated)
Idle Output Class 21 (repeated)
Idle Output Class 22

Idle Output Class 23 and (These 2 files need to be in the same directory.)

Classes 23 & 24

Input and  Output

Idle Output Class 23 (repeated)
Idle Output Class 24

Class 25
Recursion Idle Output Class 25
british-royal.txt (used with geneology functions)
Review Class 4/29/2011 Collections (repeated)    Input and Output (repeated) Idle Output
Classes 26 & 27
Final Review Sample Final (pdf file) answers for most questions (py file)
answers for turtle questions only (py file)
list-of-qutations.txt (put in same directory as py file)
Idle Output Class 26
Idle Output Class 27

Installing Software:

  1. Go to

  2. Click on Download tab on left

  3. Download Python 3.1 or greater for Windows, MAC or Linux (as appropriate)

  4. Install Python as per the instructions

Grading: 25% Homework + 20% Midterm # 1 + 20% Midterm # 2 + 35% Final


Other Information:

  1. Python 3 on an Apple: Apples often have Python 2.x pre-installed. This means that, by default, Python 2.x is used to run python programs (file type .py). This is appropriate because Python 2.x is currently more prevalent than 3.x. So, having 2.x as a default works well when you, for example, click on a python program that is on a website somewhere. This is however, kind of inconvenient for purposes of this class which is taught using Python 3.x.  Below, I will provide some information for changing the default once you install 3.x. After this course is complete, you will have the option of reversing these instructions and returning the default to 2.x.  (If you have trouble following these instructions, a graduate assistant, tutor or the instructor should be able to help.)

    1. Type "whereis python" and hit the enter key

    2. Go to the directory containing that file using the command "cd"

      • Type "cd /usr/bin" if the file is "/usr/bin/python"

    3. Find out where python3 is and pythonw3 are

      • which python3

      • which pythonw3

    4. Rename the old version of python (so that way you can change it back if you need to)

      • sudo mv python python-old

        • enter your password when prompted

    5. Create two symbolic links to the current versions of python 3

      • sudo ln -s /usr/local/bin/python3 python

        • enter your password when prompted

      • sudo ln -s /usr/local/bin/python3w python3w

        • enter your password when prompted

    6. Go to any python file in any folder (using the normal Windows or Apple GUI)

      • e.g., Applications/Python3.1/Extras/Demo/turtle/

    7. Change the default program to open it. (Go to File/Open with/Other)

      • Select Applications/Python3.1/Python Launcher

      • Click on “always open with” and enter

  2. Python 2.x versus Python 3.x: This course will use versions of Python 3, the version of Python that is expected to be prevalent in the near future. Currently, however, most Python code available on the web and most Python text books assume some version of Python 2, including some of the free textbooks described below. Therefore, it may be necessary for students to understand some of the differences.

    1. See for the full details

    2. The most important differences for this class are:

      • The print statement. Python 2 allows you to omit the parentheses. Thus the statement print('Hello') in Python 3, would be rendered as: print 'hello'

      • Python 2 has two functions input and raw_input corresponding to Python 3's function input. Python 2's function raw_input is essentially equivalent to the Python 3 function input, whereas raw_input is a special case for dealing with integers. A Python 3 statement like my_number = int(input('What is your favorite number')would simply be my_number = input('What is your favorite number') in Python 2 (coersion of the input string to integer is incorporated into the Python 2 input function).

      • Integer division in Python 2 yields an integer rather than a float as in Python 3. In Python 2: 100/40 = 2 In Python 3, 100/40 = 2.5. Python 3 has an additional operator // that functions like / in Python 2.

Additional Resources:

  1. Python Resources using Safari online at Bobst (note differences between Python 2 and 3 above):

  2. Online Python Resources:

  3. Online Free Python Textbooks (note differences between Python 2 and 3 above)

  4. Introduction to Machine Code, Assembly Language, etc. (the Professor and Pat series):

  5. Computer History