Errors
Tuples and Dictionaries
Loops and Control Flow
try/except
RANDOM
100

What kind of error is raised when dividing by zero?

ZeroDivisonError

100

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

100

What type of loop is best for repeating something while a condition is true?


While loop

100

What block is used to catch errors?

Except

100

What is the name of the person who made this?

حورا

200

What error do you get when you use a variable that hasn’t been defined yet?


NameError

200

What symbol is used to define a dictionary?


Squiggly brackets — {}

200

What does range(3) return?


0,1,2

200

Which block always runs, whether or not an error occurred?


Finally

200

Who passed the python certification test in this class?

Brian, Hawra, Natalie

300

This error occurs when you try to add a string and a number.

TypeError

300

How do you safely access a dictionary key without risking a KeyError?

(What function is used, like write the format)

my_dict.get("key")

300

What keyword skips the rest of the current loop iteration and moves to the next?


Continue


300

What kind of error will this raise?

int("hello")


ValueError

300

What was the lowest grade someone got on the certification test?

Double points if you say WHO got the score.

14%

Easton

400

What kind of error will the following code raise?

my_list = [1, 2, 3] 

 print(my_list[10])


IndexError

400

What’s the difference between my_dict.items() and my_dict.keys()?


items() returns key-value pairs, keys() returns only keys.


400

When does the else clause in a for loop execute?


Only if the loop wasn’t exited with a break.


400

What block runs only if the try block succeeds with no errors?


Else

400

What score did Natalie get on her test?

79%

500

What error is raised when you try to access a dictionary key that doesn’t exist using bracket notation?

IndexError

500

What’s wrong with this tuple definition: single = (5)?


It’s not a tuple—needs a comma: single = (5,)


500

How many times does this loop run?

for i in range(1, 10, 3):

    print(i)


(i = 1, 4, 7)


500

How do you catch multiple types of exceptions in one block?


except (TypeError, ValueError):


500

Who is the host in Great British Baking show that has black hair?

Noel Fielding

M
e
n
u