Object-oriented building blocks for data code: abstract classes, inheritance and vector operations.
42 Abu Dhabi, Python for Data Science, module 3: object-oriented programming.
| Exercise | File | What it does |
|---|---|---|
| ex00 | S1E9.py |
Abstract base class Character and a Stark subclass |
| ex01 | S1E7.py |
Baratheon and Lannister families with __str__ and __repr__ |
| ex02 | DiamondTrap.py |
King with diamond inheritance, resolved by the C3 linearization |
| ex03 | ft_calculator.py |
Vector and scalar operations |
| ex04 | ft_calculator.py |
Dot product, sum and difference of two vectors |
Stack: Python 3, standard library only.
Run an exercise from its folder, for example:
cd ex02 && python3 -c "from DiamondTrap import King; print(King('Joffrey').__dict__)"TODO: add the tester or the main file used for evaluation.