Cactus

Report a typo

Here's a class hierarchy:

class Plant:
    def __init__(self, variety):
        self.variety = variety
        print("{} is a plant".format(self.variety))


class Cactus(Plant):
    def __init__(self, variety):
        super().__init__(variety)
        print("{} is a cactus".format(self.variety))

You've created a cactus:

opuntia = Cactus("Opuntia")

What will be the output?

Enter a short text
___

Create a free account to access the full topic