Computer Science 203:

Software Engineering

Gregory M. Kapfhammer

Triangles 1 flickr photo by vincentag shared under a Creative Commons (BY-NC-ND) license

Color Scheme

Key Concept

Corresponding Diagram

In-Class Discussion

In-Class Activity

Details in the Textbook

Think Python

Chapters 5 through 8

Python Fundamentals

Chapter 5

Conditionals and Recursion

Python Programs

Mathematical expressions

Boolean expressions

Logical operations

Conditional execution

Conditional logic

Compound conditions

Nested conditions

How are Python and Java the same?

How are Python and Java different?

Recursive functions

See page 43 for an example

Chapter 6

Fruitful Functions

Return values

How are Python and Java the same?

How are Python and Java different?

Incremental development

Function composition

See page 54 for an example

Function interfaces

Elide implementation details

Function "leap of faith"

Function debugging


Precondition violated: arguments are incorrect

Postcondition violated: function is incorrect

Return value misused: calling function is incorrect

Chapter 7


Achieve repetition

while loops

for loops

for each loops

Which approach is "Pythonic"?

Debugging iterative programs

Chapter 8


Strings are sequences

Strings are immutable

Strings can be "traversed"

while loops

for each loops

in operator

String "Slicing"

s = "Monty Python"

s[0:5] is "Monty"

s[6:12] is "Python"

Optional function arguments

Default values for function arguments

How are Python and Java different?

Application to the software project