Sobes.tech
Junior — Senior

Research of methods, decorators, and inheritance in Python

livecode

Task condition

This code snippet demonstrates the different types of methods in a class, how properties are used, and how inheritance is implemented. Pay attention to:

  • The regular method get_full_name, which constructs the full name of a student;
  • The static method get_greeting, which does not depend on the state of the object;
  • The class method get_default_course, which works with the class attribute;
  • The property is_lucky, which computes a boolean value based on the length of the name and age;
  • The subclass StudentPlus, which overrides the default_course attribute and adds a new method get_full_upper_case_name.

Describe which methods and decorators are used, how the inheritance chain is built, and what results are returned when each method is called.