Comp 112

Lecture 0

Course Introduction

2018.01.25

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

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

Course Resources

Lab
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?

(discussion)

What is an Algorithm?

(discussion)

How can we Communicate an Algorithm to a Computer?

(discussion)

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

means

3 + (4 × 5)

or

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!

Algorithms

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

Algorithm
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

23

or

About Python

Python

Python is:

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

Python, the Language

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

Python, the Platform

To Do This Week: