Closed Resources
No calculator, cell phone
Written - no interactive programming
65 minutes
unary
if boolean_value:
.
.
binary
if boolean_value:
.
.
else:
.
.
chained
if boolean_value1:
.
.
elif boolean_value2:
.
.
elif boolean_value3:
.
.
else (optional)
.
.
for
loops (definite)
for item in a_list:
for i in range(len(a_list)):
while
loops (indefinite)
while boolean_object:
sentinel values
' '
or " "
string traversal
string functions, operators and methods:
+
- concatenation operator
*
- repetition operator
:
- slice operator
<
, ==
, <=
, >=
, !=
- comparison operators
in
and not in
operators
len()
function
strip()
method
split()
method
replace()
method
[ ]
list traversal
list functions, operators and methods:
len( )
function
+
- concatenation operator
*
- repetition operator
:
- slice operator
in
and not in
operators
append()
insert()
pop()
reverse()
index()
count()
remove()
list comprehensions
conversion : string \(\leftrightarrow\) list:
s = 'abcde'
s_l = [char for char in s]
print(s_l)
s_l = list(s)
print(s_l)
n_s = ''.join(s_l)
print(n_s)
( )
tuple management (like strings):
len( )
function
concatenation operator +
new_tuple = old_tuple + (new_item,)
slice operator :
new_tuple = old_tuple(:location) + (new_item,) + old_tuple(location+1:)
tuples as a function return
multiple choice and/or short answer:
basic mathematics binary operators and precedence
for
and while
loops
strings, lists and tuples
methods, functions and operators for strings, lists and tuples
accumulator pattern
boolean expressions using comparison operators
precedence : mathematical operators, relational operators, logical operators
selection (if
, if
- else
, if
- elif
- else
)
error recognition:
basic syntax - when to use ( )
, [ ]
indentation issues
improper use of strings, lists, and tuples (e.g. mutable versus immutable)
code reading:
program flow of execution (main() and other functions)
accumulator pattern
variable values at certain locations in the code
function return values
Turtle graphics and L-systems
code writing:
for
and while
loops
strings, lists and tuple
random module functions - random() and randrange()
accumulator pattern
boolean expressions using comparison operators
precedence : mathematical operators, relational operators, logical operators
selection (if
, if
- else
, if
- elif
- else
)
proper indentation
not included:
image processing
Monte Carlo method material
3n + 1 sequence
Newton’s method
character classification (9.19)