Skip to content

Latest commit

 

History

History

0x0A-python-inheritance

Python - Inheritance

Technologies

  • Files written in vi, vim, and emacs editors.
  • Files wriiten according to the betty coding style. Checked using betty-style.pl and betty-doc.pl.
  • Files tested on Ubuntu 20.04 LTS using gcc.
  • Python3.4 files

Files

File Question
0-lookup.py Write a function that returns the list of available attributes and methods of an object.
1-my_list.py Write a class MyList that inherits from list. Public instance method: def print_sorted(self): that prints the list, but sorted (ascending sort).
2-is_same_class.py Write a function that returns True if the object is exactly an instance of the specified class ; otherwise False.
3-is_kind_of_class.py Write a function that returns True if the object is an instance of, or if the object is an instance of a class that inherited from, the specified class ; otherwise False.
4-inherits_from.py Write a function that returns True if the object is an instance of a class that inherited (directly or indirectly) from the specified class ; otherwise False.
5-base_geometry.py Write an empty class BaseGeometry.
6-base_geometry.py Write a class BaseGeometry (based on 5-base_geometry.py).
7-base_geometry.py Write a class BaseGeometry (based on 6-base_geometry.py)
8-rectangle.py Write a class Rectangle that inherits from BaseGeometry (7-base_geometry.py).
9-rectangle.py Write a class Rectangle that inherits from BaseGeometry (7-base_geometry.py). (task based on 8-rectangle.py)
10-square.py Write a class Square that inherits from Rectangle (9-rectangle.py):
11-square.py Write a class Square that inherits from Rectangle (9-rectangle.py). (task based on 10-square.py).
100-my_int.py Write a class MyInt that inherits from int: MyInt is a rebel. MyInt has == and != operators inverted.
101-add_attribute.py Write a function that adds a new attribute to an object if it’s possible: Raise a TypeError exception, with the message can't add new attribute if the object can’t have new attribute.