def _enforce_args(n: int, prices: list):
    '\n    Basic checks on the arguments to the rod-cutting algorithms\n\n    n: int, the length of the rod\n    prices: list, the price list for each piece of rod.\n\n    Throws ValueError:\n\n    if n is negative or there are fewer items in the price list than the length of\n    the rod\n    '
    if (n < 0):
        raise ValueError(f'n must be greater than or equal to 0. Got n = {n}')
    if (n > len(prices)):
        raise ValueError(f'Each integral piece of rod must have a corresponding price. Got n = {n} but length of prices = {len(prices)}')
Basic checks on the arguments to the rod-cutting algorithms

n: int, the length of the rod
prices: list, the price list for each piece of rod.

Throws ValueError:

if n is negative or there are fewer items in the price list than the length of
the rod
def _enforce_args(n: int, prices: list):
    '\n    Basic checks on the arguments to the rod-cutting algorithms\n\n    n: int, the length of the rod\n    prices: list, the price list for each piece of rod.\n\n    Throws ValueError:\n\n    if n is negative or there are fewer items in the price list than the length of\n    the rod\n    '
    if (n < 0):
        raise ValueError(f'n must be greater than or equal to 0. Got n = {n}')
    if (n > len(prices)):
        raise ValueError(f'Each integral piece of rod must have a corresponding price. Got n = {n} but length of prices = {len(prices)}')