- Explain class attributes vs. instance attributes
- True or False? not every object in Python has attributes
- True or False? An attribute doesn't exist on the variable, but rather on the object that the variable refers to
- In the following block of code
x
is a class attribute whileself.y
is a instance attribute
class MyClass(object):
x = 1
def __init__(self, y):
self.y = y
- False. Every object in Python has attributes
- True