What kind of error is raised when dividing by zero?
ZeroDivisonError
Are tuples mutable or immutable?
(If you genuinely get this wrong, I have no idea if you ever listened to anything in this class)
Immutable
What type of loop is best for repeating something while a condition is true?
While loop
What block is used to catch errors?
Except
What is the name of the person who made this?
حورا
What error do you get when you use a variable that hasn’t been defined yet?
NameError
What symbol is used to define a dictionary?
Squiggly brackets — {}
What does range(3) return?
0,1,2
Which block always runs, whether or not an error occurred?
Finally
Who passed the python certification test in this class?
Brian, Hawra, Natalie
This error occurs when you try to add a string and a number.
TypeError
How do you safely access a dictionary key without risking a KeyError?
(What function is used, like write the format)
my_dict.get("key")
What keyword skips the rest of the current loop iteration and moves to the next?
What kind of error will this raise?
int("hello")
ValueError
What was the lowest grade someone got on the certification test?
Double points if you say WHO got the score.
14%
Easton
What kind of error will the following code raise?
my_list = [1, 2, 3]
print(my_list[10])
IndexError
What’s the difference between my_dict.items() and my_dict.keys()?
items() returns key-value pairs, keys() returns only keys.
When does the else clause in a for loop execute?
Only if the loop wasn’t exited with a break.
What block runs only if the try block succeeds with no errors?
Else
What score did Natalie get on her test?
79%
What error is raised when you try to access a dictionary key that doesn’t exist using bracket notation?
IndexError
What’s wrong with this tuple definition: single = (5)?
It’s not a tuple—needs a comma: single = (5,)
How many times does this loop run?
for i in range(1, 10, 3):
print(i)
(i = 1, 4, 7)
How do you catch multiple types of exceptions in one block?
except (TypeError, ValueError):
Who is the host in Great British Baking show that has black hair?
Noel Fielding