Find the magic

Report a typo

Which of the methods of the class Person are magic methods?

class Person:
    def __init__(self, name, age):
        self.name = name
        self.age = age
        self.friends = []

    def greet(self):
        print("Hello, I am {}".format(self.name))

    def make_friends(self, other):
        self.friends.append(other)
        print("{} is now friends with {}".format(self.name, other.name))

    def __str__(self):
        return "{}, {} years old".format(self.name, self.age)
Select one or more options from the list
___

Create a free account to access the full topic