Robot

Report a typo

Suppose we have the following class hierarchy:

class Robot:
    def greet(self):
        print("I am a robot")


class Android(Robot):
    def greet(self):
        super().greet()
        print("I am an android")


class PersonalAssistant(Robot):
    def greet(self):
        super().greet()
        print("I am a personal assistant")


class AssistantAndroid(Android, PersonalAssistant):
    def greet(self):
        super().greet()

We've created an instance of the class AssistantAndroid and called the greet method. What will be the output?

NOTE: pay attention to the order of the super() calls and print().

The options are the following:

a)

# I am a robot
# I am a personal assistant
# I am an android

b)

# I am a robot
# I am an android
# I am a personal assistant

c)

# I am an android

d)

# I am a personal assistant
# I am a robot
# I am an android

e)

# I am an android
# I am a personal assistant
# I am a robot
Select one option from the list
___

Create a free account to access the full topic