-
What Python statements should you put inside the
try block of a
try/except statement.
any statement that can cause a runtime error
-
Can there be different
except clauses for different exceptions?
yes
-
When is the code in the
else block of a try/except statement
executed?
after all the statements in the try block have run
without raising an exception
-
When is the code in the
finally block of a try/except statement
executed?
after all the statements in the try block and
all exception handlers have run
-
What do you call a collection of things stored one right after another?
a sequence
-
What is a list?
a sequence object that can be changed
-
What is a tuple?
a sequence object that cannot be changed
-
Write an assignment statement that creates an empty list and assigns it to
the variable empty.
empty = []
-
Write an assignment statement that creates a list of the first 5 integers and
assigns it to the variable l1.
l1 = [1, 2, 3, 4, 5]
-
What expression would you write to get the number of values in the
list l1?
len(l1)