Skip to content

Latest commit

 

History

History

0x06-python-classes

Project: 0x06. Python - Classes and Objects

This directory contains projects focused on understanding and implementing object-oriented programming (OOP) concepts in Python. The tasks cover creating classes, defining methods, using attributes, and understanding the principles of OOP such as encapsulation, inheritance, and polymorphism.

Resources

Read or watch

Learning Objectives

General

  • Why Python programming is awesome
  • What is OOP
  • “first-class everything”
  • What is a class
  • What is an object and an instance
  • What is the difference between a class and an object or instance
  • What is an attribute
  • What are and how to use public, protected and private attributes
  • What is self
  • What is a method
  • What is the special __init__ method and how to use it
  • What is Data Abstraction, Data Encapsulation, and Information Hiding
  • What is a property
  • What is the difference between an attribute and a property in Python
  • What is the Pythonic way to write getters and setters in Python
  • How to dynamically create arbitrary new attributes for existing instances of a class
  • How to bind attributes to object and classes
  • What is the __dict__ of a class and/or instance of a class and what does it contain
  • How does Python find the attributes of an object or class
  • How to use the getattr function

Tasks

Task File Description
0. My first square 0-square.py Write an empty class Square that defines a square.
1. Square with size 1-square.py Write a class Square that defines a square by its size.
2. Size validation 2-square.py Write a class Square that defines a square and validates the size attribute.
3. Area of a square 3-square.py Write a class Square that defines a square and includes a method to calculate its area.
4. Access and update private attribute 4-square.py Write a class Square that defines a square and allows access and update of private attributes.
5. Printing a square 5-square.py Write a class Square that defines a square and includes a method to print the square.
6. Coordinates of a square 6-square.py Write a class Square that defines a square and includes coordinates for positioning.
7. Singly linked list 100-singly_linked_list.py Write a class Node that defines a node of a singly linked list and a class SinglyLinkedList.
8. Print Square instance 101-square.py Write a class Square that defines a square and includes a custom string representation.
9. Compare 2 squares 102-square.py Write a class Square that defines a square and includes methods to compare two squares.
10. ByteCode -> Python #5 103-magic_class.py Write the Python class MagicClass that does exactly the same as a given Python bytecode.