CS 170 Exam Two Terms and Concepts
Previous material
You are expected to remember and be able to use the concepts that
were covered on Exam 1, such as assignment statements, functions,
for loops, and accumulation patterns, among other things.
Selection statements
- if elif else: know how to write programs that use if
statements to allow choices in what code is executed. Know how to
indent these properly. Understand how control flows as if
statements are executing.
- Boolean and logical expressions: understand what a Boolean
value is (true or false) and how to use relational operators and
logical operators to construct them.
While loops
- while loops: know how to write programs that use while
loops, be able to construct a while loop that is equivalent to a
given for loop, understand when while loops are preferred and when
for loops are preferred, be able to implement code with nested
loops as necessary
- Newton's Method: recall how we used Newton's method to
calculate square roots, including the use of epsilon values to
determine when two floats are close enough to be considered
equivalent
- Data validation: Know how to use data validation loops to
make sure that input from the user is correct.
Integer arithmetic
- mod and integer division: understand how these
expressions work and why they can be useful.
Strings
- strings: how strings work in Python, how we can index them
from left to right (using 0 to len-1) and from right to left (using
-1 to -len), slices of strings (including all variations of the
colon notation), concatenation using +, use of in
and not in operators.