In addition to all concepts from Quiz 1,
You should be able to define the following terms:
- branching and looping
- the Accumulator design pattern
- data types: integer, float, string, boolean, list
You should understand and be able to use the following Python concepts:
- basic arithmetic expressions using +, -, *, /, **, %
- conversion between the int, float, and str types
- reading in strings using raw_input()
- the empty string ""
- string concatenation with +, repetition with *
- string and list indexing with []
- string and list slicing with [:]
- for loops over strings and lists
- len()
- tracing a program
- if, if/else, if/elif/else
- the relational operators <, <=, ==, >, >=, !=
- the boolean operators and, or, and not
- the random library functions: randrange(), choice()
- nested statements (loop in a loop; loop in an if/else; etc)
Practice problems:
- Programming exercises 1, 4, and 8 on page 228-229 of Zelle; excerise 10 on page 120
- True/false questions 1, 2, 4, 7, 8 on pages 225-226 of Zelle; questions 1, 2, 3, and 4 on page 115
- Multiple choice problems 2, 3, 5, 6, 7, 10 on pages 226-227 of Zelle.
- Discussion question 1, parts (a) through (f) on page 116 of Zelle.
- Trace the behavior of the following program:
x = 3
print 0,x
for i in range(1,6):
if x % 2 == 0:
x = x / 2
else:
x = (3*x+1)/2
print i,x
include("../style/footer.php"); ?>