0

why it is showing this error

code: class School: def __init__(self,first,last,pay): self.first=first self.last=last self.pay=pay class Teachers(School): def __init__(self,first,last,pay,occupation): School.__init__(first,last,pay) self.occupation =occupation class Principal(School): def __init__(self, first, last, pay, occupation): School.__init__(first,last,pay) self.occupation=occupation p1= Principal("RK","Meena",115000,"Principal") t1= Teachers("Manoj","Kumawat",68000,"Teacher") error: Traceback (most recent call last): File "/home/socialengineer100/.PyCharmCE2018.2/config/scratches/scratch.py", line 18, in <module> p1= Principal("RK","Meena",115000,"Principal") File "/home/socialengineer100/.PyCharmCE2018.2/config/scratches/scratch.py", line 14, in __init__ School.__init__(first,last,pay) TypeError: __init__() missing 1 required positional argument: 'pay'

30th Aug 2018, 9:44 AM
anubhav mandarwal
anubhav mandarwal - avatar
1 Odpowiedź
+ 3
use School.__init__(self, 'RK', 'Meena', 115000) or super().__init__('RK', 'Meena', 115000)
30th Aug 2018, 11:11 AM
Mert Yazıcı
Mert Yazıcı - avatar