Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1species = 'Canine' # in __init__ | AValid: Class variable shared by all instances | |
| 2species = Canine | BError: Class variables belong outside __init__ | |
| 3species = 'Canine' # in class body | COutput: False | |
| 4self.name = name | DOutput: False | |
| 5bool(0) | EOk: Instance variable unique to each object | |
| 6bool([]) | FError: Missing quotes around string value |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Class variable — Variable defined in the class body and shared by all instances.~~Instance variableclass Dog:
species = 'Canine'class Dog:
count = 0
def __init__(self, name):
Dog.count += 1class Dog:
count = 0
def __init__(self, name):
self.count += 1d = Dog('Rex')
print(d.name)print(Dog.species)