+ 1

Can anyone help with this???

class Ve: def __init__(self,arr): self.arr=arr def func(self): return sum(self.arr) class N(Ve): def __init__(self,arr,q): super.__init__(arr) self.q=q def fun(self): if self.q in self.arr: return "hello" else: return "hello world" i = N([1,2,3,4],4) print(i.func()) print(i.fun())

5th Jan 2022, 6:16 AM
Ravi King
2 Respostas
+ 2
super.__init__(arr) to super(N, self).__init__(arr)
5th Jan 2022, 6:22 AM
FanYu
FanYu - avatar
+ 1
more concept, just search it: super and MRO(Method Resolution Order)
5th Jan 2022, 5:17 PM
FanYu
FanYu - avatar