class Profile:
def __init__(self, name, hobby):
self.name = name
self.hobby = "My favourite hobby is " + hobby
self.funfact = None
def introduce(self):
print("Hi there, I'm {}. My favoruite hobby is {}.".format(self.name,self.hobby))
def greet(self, visitor):
print(f"Hello, {visitor}")
def add_funfact(self,fact=None):
self.funfact = fact
def get_funfact(self):
return self.funfact if self.funfact else "There's nothing interesting about me :("
>> system1970 = Profile("system1970","Learning")
>> system1970.introduce()
Hi There, I'm system1970. My favourite hobby is Learning.
>> system1970.get_funfact()
There's nothing interesting about me :(
>> system1970.add_funfact("System1970 Loves AI")
>> system1970.get_funfact()
System1970 Loves AI