Question

The following Python code attempts to call a method from the parent class, but it's using an outdated or incorrect syntax. How should it be corrected? class Parent:     def greet(self):         print("Hello from Parent") class Child(Parent):     def greet(self):         print("Hello from Child")         # Parent.greet(self) # Problematic c = Child()
c.greet()

A Change `Parent.greet(self)` to `super().greet()`.
B Change `Parent.greet(self)` to `self.greet()`.
C Remove the `greet` method from `Child`.
D Change `Parent` to `Base`.
E The syntax `Parent.greet(self)` is correct and works.
Practice Next

Hey! Ask a query