Find the output of the given code in python


a= A(7)
del a.x
print (a.x)" AttributeError
"What is the output of the following code?
Class A:
def getC(self):
print ('In Class A, method getC.')
class B(A):
b= B()
b.grtC()" " In Class A, method getC.
In class A, method getC



In the above question, we have to find the output of the given code in python language. Code has a different function. The output of this program will be In Class A, method getC.
In Class A, method getC.


We have a program code in python in which Class A and Class B are two different classes defined here. Both the classes have their own functions. Class A has a print statement and in that print statement, there is an output statement that is printed on the screen.
Class B has a parameter of name Class A. So the statement in class A will also get printed in class B. That’s why we can see the two output statements in the output screen. Also, there is two functions calling with the b variable.


class A:
    def getC(self):
        print("In Class A, method getC.")

class B(A):



code in python


Also read, Consider the class diagram below figure which illustrates the data model for the supervision of student projects

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *