Lecture Notes
CPSC 121 (Fall 2013)
Today .
Quiz 5
Lists (cont.)
Homework .
HW 7 due
HW 8 out
Robots 3 due Thurs
S. Bowers
1 of 6
Lecture Notes
CPSC 121 (Fall 2013)
Lists are mutable (can be modied)
The index (aka subscript) operator
listvar[index]
E
Lecture Notes
CPSC 121 (Fall 2013)
Today .
Math library
More on lists
Scribbler lab
Homework .
Robots 2 due
Robots 3 out
S. Bowers
1 of 6
Lecture Notes
CPSC 121 (Fall 2013)
The math module
The math module contains many often used mathematical functio
Lecture Notes
CPSC 121 (Fall 2013)
Today .
Comments and white space
Math operators and expressions
Lists (intro)
Homework .
HW 6 due
HW 7 out
Robots 2 due Thurs
S. Bowers
1 of 8
Lecture Notes
CPSC 121 (Fall 2013)
Comments
Comments are special notes
Lecture Notes
CPSC 121 (Fall 2013)
Today .
Swap
Accumulator pattern
While loops
Homework .
HW 5 due
HW 6 out
Robots 1 due Thurs
S. Bowers
1 of 8
Lecture Notes
CPSC 121 (Fall 2013)
Exercise: Swapping values
Lets say we have a variable x and y, e.g.:
Lecture Notes
CPSC 121 (Fall 2013)
Today .
Range loops (cont.)
Intro to Scribblers
Homework .
First Scribbler project (robots1)
S. Bowers
1 of 6
Lecture Notes
CPSC 121 (Fall 2013)
Q: What does this code do?
n = int(input(Enter a number: )
for v in rang
Lecture Notes
CPSC 121 (Fall 2013)
Today .
Quiz 3
Function variable visibility
Range function
S. Bowers
1 of 8
Lecture Notes
CPSC 121 (Fall 2013)
Exercise
What is returned by the following? Check your guess in Python.
1. 5 or True
2. (1 < 2) and "spam
Lecture Notes
CPSC 121 (Fall 2013)
Today .
Boolean expressions (cont.)
Conditionals
S. Bowers
1 of 13
Lecture Notes
CPSC 121 (Fall 2013)
Logical expressions can be nested
> (not (2 > 3) or (4 < 2) and not (2 > 3) or False)
True
If operands are not Boole
Lecture Notes
CPSC 121 (Fall 2013)
Today .
Quiz 2
Booleans
Homework
HW 3 due
HW 4 out
Note
Were covering the ve main construct basics:
sequence, assignment (variables), abstraction, conditionals, iteration
Well then go more depth into each
S. Bower
Lecture Notes
CPSC 121 (Fall 2013)
Today .
Python Variables
More print statements
Random ints and user input
Notes on Hw 2
3 separate things to turn in:
1. Reading assignment (separate paper)
2. Hard copy of source code (separate paper)
3. Submit sour
Lecture Notes
CPSC 121 (Fall 2013)
Today .
Computation (cont.)
Programming Language basics
Python Values and Types
Homework
Hw 2 out (Due next Tues)
Reminder
Meet in the CS Lab again on Thursday
S. Bowers
1 of 11
Lecture Notes
CPSC 121 (Fall 2013)
Co
Lecture Notes
CPSC 121 (Fall 2013)
Today .
Intro to the Lab
Computation basics
S. Bowers
1 of 8
Lecture Notes
CPSC 121 (Fall 2013)
Getting started in the CS Lab
The CS lab guide
http:/www.cs.gonzaga.edu/startup_guide.html
Login using GU userid and pass