Question: class A ( ) : x = 1 def _ _ init _ _ ( self , n ) : self.y = n A .

class A():
x =1
def __init__(self, n):
self.y = n
A.x +=1
def p(self):
print(self.y)
self.y +=3
self.r()
def r(self):
self.y +=2
print(self.y)
class B(A):
x =10
def __init__(self, n):
super().__init__(n)
sum = self.y + B.x
self.m = sum
def r(self):
self.y += self.x
print(self.m)
a = A(1)
b = B(2)
a.p()
b.p()
global variable is created on line

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!