Here is my code which is supposed to print self.cake and self.age from the class Settings.
from startup import Settings
class Profile(Settings):
def __init__(self):
super(Profile, self).__init__()
def print_settings(self):
print self.cake
print self.age
p = Profile()
p. print_settings()
Other python script
class Settings(object):
def __init__(self):
self.cake = 1
def number(self):
self.age = 5
But I keep getting:
AttributeError: 'Profile' object has no attribute 'age'
I need to be able to print the variables from the print_settings function.
What should I do?
self.cakeandself.ageto__init__functionself.age=Nonein__init__function