Python - Custom Exceptions
Which of the following statements correctly adds a custom attribute
age with value 5 to an instance dog of a class Animal?age with value 5 to an instance dog of a class Animal?instance.attribute = value.age attribute. dog["age"] = 5 uses dictionary syntax which is invalid for objects. setattr(dog, 5, "age") misuses setattr parameters order. dog.add("age", 5) calls a non-existent method.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions