What is the output of the following code in Python 3.x? class A: def __init__(self): self.calculate(30) def calculate(self, i): self.i = 2 * i class B(A): def __init__(self): super().__init__() print(“i in Class B is”, self.i) def calculate(self, i): self.i = 3 * i b = B()

Questions & AnswersCategory: PythonWhat is the output of the following code in Python 3.x? class A: def __init__(self): self.calculate(30) def calculate(self, i): self.i = 2 * i class B(A): def __init__(self): super().__init__() print(“i in Class B is”, self.i) def calculate(self, i): self.i = 3 * i b = B()
Geek Boy Staff asked 2 years ago

What is the output of the following code in Python 3.x?

class A:
    def __init__(self):
        self.calculate(30)
    
    def calculate(self, i):
        self.i = 2 * i
        
class B(A):
    def __init__(self):
        super().__init__()
        print("i in Class B is", self.i)
    
    def calculate(self, i):
        self.i = 3 * i
        
b = B()

a. “i in Class B is 60”
b. “i in Class B is 90”
c. “i in Class B is 0”
d. Error