Course Info

Section: 003
Instructor: Lori Case
E-mail: lori.case@uwaterloo.ca
Office: DC 3103
Office Hours: See Office Hours or by appointment.

CS 116

Python only now (We are testing to see if CS 116 works as just Python)

Small note: They altered the CS 115 to accomodate for this change in CS 116. At the time of writing this in Spring 2016, I took CS 115 almost two years ago in Fall of 2014. There is some information that is familiar to people who took CS 115 last term (Winter 2016) but not to people like me due to the changes in CS 115.

###Some Python Basics:

###A very simple Python program:
x = 2 * (4 + 12) y = x +8
z = y * y
w = “hi”
u = w + w

Scheme   Python    
Value: Representation: Type: Representation: Type:
natural exact Nat exact Nat
integer exact Int exact Int
rational exact Num inexact Float
irrational inexact Num inexact Float

##Basic Mathematical Operations

Division:
x / y

Integer division:
x // y

Remainder
x % y

Exponents
x ** y

###Last Tips:

###Functions in Python:

fn_name (arg1, arg2, …, argN)

abs(-3.8) => 3.8
type(5) => <type ‘int’>
max(3,5,9) => 9

###The Math Module

To use functions from math

Intro to CS 116 | Home