1 class Grandfather:
2 last = 'wilson'
3 citizenship = 'american'
4 residence = 'Detroit'
5 def __init__(self,first,college,age,career,workplace):
6 self.first = first
7 self.college = college
8 self.age = age
9 self.career = career
10 self.workplace = workplace
11 self.email = first + '-' + Grandfather.last + '@email.com'
12 @property
13 def fullname(self):
14 return '{} {}'.format(self.first,Grandfather.last)
15 def __str__(self):
16 return '{} {}'.format(self.first,self.last)
17 @property
18 def history(self):
19 return 'my name is : {}, i graduated from {} and work as {} in {}'.format\
20 (self.fullname,self.college,self.career,self.workplace)
21 @classmethod
22 def set_residence(cls,newR):
23 cls.residence = newR
24 @classmethod
25 def set_cit(cls,new_cit):
26 cls.citizenship = new_cit
27
28
29
30
31 class Father(Grandfather):
32 def __init__(self,first,college,age,career,workplace,sport,wife):
33 super().__init__(first,college,age,career,workplace)
34 self.sport = sport
35 self.wife = wife
36
37
38 class Son(Father):
39 def __init__(self,first,college,age,career,workplace,Vedio_Game,Car):
40 super().__init__(first,college,age,career,workplace)
41 self.Vedio_Game = Vedio_Game
42 self.Car = Car
43
44 john = Grandfather('john','stanford',70,'engineer','Ford')
45 mark = Father('mark','MIT',40,'CScientist','SONY','Tennis','Sara')
46 Anna = Aunt('Anna','Cambridge',38,'Teacher','school','black','Basketball')
47 Maik = Son('Maik','MIT',26,'SoftwareEngineer','Google','MineCraft','Toyota')
48 if __name__ == '__main__':
49 print(john.fullname)
50 print(john)
51 print(john.history)
52 Grandfather.set_residence('Frankfurt')
53 print(Grandfather.residence)
54 print('############')
55 print(mark.fullname)
56 print(mark)
57 print(mark.history)
58 print(mark.residence)
59 print('###########')
60 print(Maik.fullname)
61 print(Maik)
62 print(Maik.residence)
What I have tried:
i tried to execute the program but it throws the error :
Traceback (most recent call last):
File "my_Errors.py", line 66, in <module>
Maik = Son('Maik','MIT',26,'SoftwareEngineer','Google','MineCraft','Toyota')
File "my_Errors.py", line 40, in __init__
super().__init__(first,college,age,career,workplace)
TypeError: __init__() missing 2 required positional arguments: 'sport' and 'wife'