from dataclasses import dataclass
@dataclass
class InventoryItem:
"""Class for keeping track of an item in inventory."""
name: str
unit_price: float
quantity_on_hand: int = 0
def total_cost(self) -> float:
return self.unit_price * self.quantity_on_hand
my_item = InventoryItem(name='Notebook', unit_price=9.99, quantity_on_hand=5)
print(f'We have {my_item.total_cost()} worth of {my_item.name}')
subprocess
sh
(pip-installable)argparse
lets you specify arguments for a command-line interface:
pathlib
tqdm
:xled
for Twinkly lights .py
files) of functionsREADME
and LICENSE
rye
pytest
ruff
git