@@ -23,15 +23,59 @@ def get_full_name(self) -> str:
2323 return f"{ self .first_name } { self .last_name } { suffix } "
2424
2525person1 = Child ("Elizaveta" , "Alekseeva" )
26+ # Prediction: Creates instance of Child class with first name "Elizaveta" and last name "Alekseeva".
27+ print (person1 )
28+ print (person1 .first_name )
29+ print (person1 .last_name )
30+ # Outcome: As expected.
31+
32+
2633print (person1 .get_name ())
34+ # Prediction: Child inherits Parent methods, therefore calls get_name method: "Elizaveta Alekseeva"
35+ # Outcome: As expected.
36+
2737print (person1 .get_full_name ())
38+ # Prediction: Calls get_full_name on child, no previous names: "Elizaveta Alekseeva"
39+ # Outcome: As expected.
40+
2841person1 .change_last_name ("Tyurina" )
42+ # Prediction: Changes last_name to "Tyurina", and previous_last_names to ["Alekseeva"], returns nothing
43+ print (person1 .last_name )
44+ print (person1 .previous_last_names )
45+ # Outcome: As expected.
46+
2947print (person1 .get_name ())
48+ # Prediction: Child inherits Parent methods, therefore calls get_name method: "Elizaveta Alekseeva"
49+ # Outcome: As expected.
50+
3051print (person1 .get_full_name ())
52+ # Prediction: Returns first_name last_name (née previous_last_names[0]) (original last name)
53+ # ""Elizaveta Tyurina (née Alekseeva)"
54+ # Outcome: As expected.
3155
3256person2 = Parent ("Elizaveta" , "Alekseeva" )
57+ # Prediction: Creates instance of Parent class with first name "Elizaveta" and last name "Alekseeva".
58+ print (person2 )
59+ print (person2 .first_name )
60+ print (person2 .last_name )
61+ # Outcome: As expected.
62+
3363print (person2 .get_name ())
64+ # Prediction: Calls get_name method: "Elizaveta Alekseeva"
65+ # Outcome: As expected.
66+
3467# print(person2.get_full_name())
68+ # Prediction: Parent instance has not access to Child methods, will error that there is no method of get_full_name.
69+ # Outcome: AttributeError: 'Parent' object has no attribute 'get_full_name'
70+
3571# person2.change_last_name("Tyurina")
72+ # Prediction: Parent instance has not access to Child methods, will error that there is no method of change_last_name.
73+ # Outcome: AttributeError: 'Parent' object has no attribute 'change_last_name'
74+
3675print (person2 .get_name ())
37- # print(person2.get_full_name())
76+ # Prediction: Calls get_name method: "Elizaveta Alekseeva" as name has not changed due to inability to call change_last_name
77+ # Outcome: As expected.
78+
79+ # print(person2.get_full_name())
80+ # Prediction: Parent instance has not access to Child methods, will error that there is no method of get_full_name.
81+ # Outcome: AttributeError: 'Parent' object has no attribute 'get_full_name'
0 commit comments