Keep reusable code clean and production-ready: reusable/algorithmic functions should be side-effect free (no print()), and all executable/demo/driver code must be under an if __name__ == "__main__": guard. Also keep imports at the top and sorted/PEP8-compliant.

Example (move prints + examples):

def quick_select(items: list[int], index: int) -> int:
    # reusable logic: no printing, no prompting
    ...


def _demo() -> None:
    prices = [7, 1, 5, 3, 6, 4]
    print("Example:", quick_select(prices, 3))


if __name__ == "__main__":
    _demo()

Checklist: