Basic object-oriented programming in Python. See Class (computer programming) — Wikipedia.
| Method | Purpose |
|---|---|
__init__ |
Constructor — initialises the object's attributes |
__str__ |
Controls what print(obj) displays |
__eq__ |
Controls how == compares two objects |
Represents a line segment between two 2D points. Computes the Euclidean distance between them.
python classes.py