What is left of the bundle a class was supposed to guarantee once outside code can assign `a.age = "twelve"` or bolt a brand-new attribute onto one instance?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
The given Critter class defines exactly two data attributes, and one critter aged 4 has already been built. From outside the class, make all three of the moves this video warns about on critter:
name attribute to the string "furball",age attribute with the string "twelve",size holding the string "tiny".Every one of those lines runs without a complaint — that silence is the exercise.
class Critter(object):
""" A critter with a name and an age """
def __init__(self, age):
""" age is an int """
self.name = None
self.age = age
critter = Critter(4)