Comp 112

Lecture 0

Course Introduction


About the Course

Course Topic

Introduction to imperative programming, using the programming language Python.

Course Objectives

Course Audience

Is this course for you?

Course Components

weekly (Tuesdays, 8:50AM, Exley 109)
weekly (Tuesdays, 8:50AM, Exley 74)
free online book: Think Python (2nd ed.). Readings assigned weekly.
weekly (released to Moodle shortly after each lecture, due by beginning of following lecture)
two midterms (on March 8 and May 3)
Programming Project
in lieu of final exam at end of semester (details to follow)

Course Resources

instructor and C.A.s
Drop-In Help Clinic
run by C.A.s on Sun., Mon. and Thurs. evenings 7:00-9:00 in Exley 103
Office Hours
scheduled and by appointment

About Imperative Programming

What do Computers do?


What is an Algorithm?


How can we Communicate an Algorithm to a Computer?


Programming Languages

A programming language is a formal language for representing and manipulating information and performing tasks.

An imperative programming language does this using sequences of instructions. (Do this, next do that…)

Why Learn to Program?

How to Learn Programming

Learning programming is a process,

to be successful, you need to invest time and attention.

Programming is Like…

A natural language
it has a vocabulary and rules of grammar that we need to learn and follow.
A natural science
to understand how a piece of software works we can perform observations and experiments.
A mathematical theory
computers operate by following precise rules; by learning to mentally model them we can predict and direct the computer’s behavior.

Why Might Programming Seem Hard?

Syntax and Parsing

Natural languages tend to be complex and flexible:

To die, to sleep; to sleep, perchance to dream; aye, there’s the rub, for in that sleep of death, what dreams may come, when we have shuffled off this mortal coil, must give us pause.

Formal languages are typically simple but rigid:

D=(x2x1)2+(y2y1)2D = \sqrt {(x_2 - x_1)^2 + (y_2 - y_1)^2}

Example: Parsing Arithmetic

3 + 4 × 5


3 + (4 × 5)


Note: although “3+(4×5)3 + (4 × 5)” and “(5×4)+3(5 × 4) + 3” have the same value, they are not the same expression!


Named for Al-Khwārizmī, a 9th c. Persian mathematician, astronomer and cartographer.

a complete description of a procedure for accomplishing some task.

Programming languages let us communicate algorithms to computers.

Upshot: the computers can do the work of carrying them out!

Historical note: a “computer” used to be a person.

Example: Evaluating Arithmetic

3 + (4 × 5)

steps to

3 + 20

steps to



About Python


Python is:

In this course we will use the Python language version 3.

Python, the Language

lots of users, platforms, libraries and tools
details of the underlying hardware, operating system, etc. are abstracted away

Python, the Platform

To Do This Week: