27 lines
838 B
Python
27 lines
838 B
Python
from collections.abc import Callable
|
|
from types import TracebackType
|
|
|
|
|
|
def percentage_discount(percent: int) -> Callable[[int], int]:
|
|
raise NotImplementedError("Zwróć funkcję obliczającą cenę po rabacie percent%")
|
|
|
|
|
|
def apply_discount(price_cents: int, strategy: Callable[[int], int]) -> int:
|
|
raise NotImplementedError("Zastosuj strategy do price_cents (nie zwracaj wartości < 0)")
|
|
|
|
|
|
class ManagedFlag:
|
|
def __init__(self) -> None:
|
|
self.active: bool = False
|
|
|
|
def __enter__(self) -> "ManagedFlag":
|
|
raise NotImplementedError("Ustaw self.active = True i zwróć self")
|
|
|
|
def __exit__(
|
|
self,
|
|
exc_type: type[BaseException] | None,
|
|
exc_val: BaseException | None,
|
|
exc_tb: TracebackType | None,
|
|
) -> None:
|
|
raise NotImplementedError("Ustaw self.active = False")
|