# For this exercise you can assume all input numbers are non-negative,
# meaning greater than or equal to 0, unless otherwise specified.

def simple_full_packages(order, package_limit):
    '''
    Calculate the number of full packages that can be delivered, assuming near 
    infinite inventory.

    Inputs:
        order (int) - number of items requested
        package_limit (int) - number of items that can fit in a shipment
          container
    
    Returns:
        The integer number of completely filled packages. 

    Examples:
        simple_full_packages(10, 0) -> 0
        simple_full_packages(10, 3) -> 3 
        simple_full_packages(5, 5)  -> 1
    '''
    # An example of a correct solution
    if package_limit == 0:
        num_packages = 0  # avoid Division by 0 error
    else:
        num_packages = order // package_limit  
    
    return num_packages


def simple_unfulfilled_items(order, package_limit):
    ''' 
    Calculate the number of items remaining after filling as many containers
    as possible. 

    Inputs:
        order (int) - number of items requested
        package_limit (int) - items that can fit in a shipment container
    
    Returns:
        The integer number of remaining items.
    
    Examples:
        simple_unfulfilled_items(10, 0) -> 10
        simple_unfulfilled_items(10, 3) -> 1 
        simple_unfulfilled_items(5, 5)  -> 0
    '''
    pass # replace this line and start your code here


def num_packages(order, package_limit):
    ''' 
    Calculate the fewest number of packages that would be required to ship 
    all items in an order.

    Inputs:
        order (int) - number of items requested
        package_limit (int) - positive number of items that can fit in a 
                                shipment container
    
    Returns:
        The integer number of packages required. 
    
    Examples:
        num_packages(10, 1) -> 10
        num_packages(10, 3) -> 4
        num_packages(10, 5) -> 2

    '''
    pass # replace this line and start your code here


def simple_shipping_days(day, is_holiday):
    '''
    Calculate the number of days an order will take ship from the facility. 
    If the order was placed during the week (Monday-Friday), an order will 
    take 4 days to leave the facility if it is not a holiday. Orders placed on 
    a holiday during the week (Monday-Friday) take 5 days to ship. Orders 
    placed on a Saturday take 6 days and Sunday orders take 5 days to ship.

    Inputs:
        day (int) - day of the week. Sunday = 0, Monday = 1, Tuesday = 2, 
                        Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6
        is_holiday (bool) - True if the order day is a holiday, False otherwise

    Returns:
        The integer number of days.
    
    Examples:
        simple_shipping_days(5, False) -> 4
        simple_shipping_days(3, True)  -> 5
        simple_shipping_days(6, True)  -> 6
        simple_shipping_days(0, False) -> 5
    '''
    pass # replace this line and start your code here


def full_packages(inventory, order, package_limit):
    ''' 
    Given the current inventory, calculate the number of full packages that can 
    be delivered.

    Inputs:
        inventory (int) - number of items in stock
        order (int) - number of items requested
        package_limit (int) - number of items that can fit in a shipment 
                              container
    
    Returns:
        The integer number of full containers that can be shipped.
    
    Examples:
        full_packages(10, 3, 5)  -> 0 
        full_packages(2, 6, 5)   -> 0
        full_packages(11, 16, 5) -> 2
        full_packages(50, 10, 3) -> 3
    '''
    pass # replace this line and start your code here


def unfulfilled_items(inventory, order, package_limit):
    ''' 
    Return the number of items in an order that cannot be shipped in
    full packages, due to lack of inventory and/or the package_limit.

    Inputs:
        inventory (int) - number of items in stock
        order (int) - number of items requested
        package_limit (int) - number of items that can fit in a shipment container
    
    Returns:
        The integer number of items remaining in an order.
    
    Examples:
        unfulfilled_items(10, 3, 5)  -> 3 
        unfulfilled_items(7, 6, 2)   -> 0
        unfulfilled_items(10, 15, 5) -> 5
        unfulfilled_items(50, 10, 3) -> 1
    '''
    pass # replace this line and start your code here


def shipping_days(number_packages, day, is_holiday):
    '''
    Return the number of days an order will take to ship. Standard shipping 
    takes 4 days if the order was placed during Monday-Friday. The same 
    rules for simple_shipping_days apply, but we will also add one day for 
    every 100 packages.

    Inputs:
        number_packages (int) - number of boxes of items, greater than 0
        day (int) - day of the week. Sunday = 0, Monday = 1, Tuesday = 2, 
                        Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6.
        is_holiday (bool) - True if the order day is a holiday, False otherwise
    
    Returns:
        The integer number of days the packages will take to arrive.
    
    Examples:
        shipping_days(10, 1, False) -> 4
        shipping_days(101, 1, False) -> 5
        shipping_days(201, 1, False) -> 6
        shipping_days(10, 5, True) -> 5
        shipping_days(10, 6, True) -> 6 
        shipping_days(10, 0, False) -> 5
        shipping_days(210, 6, True) -> 8 
    '''
    pass # replace this line and start your code here


if __name__ == "__main__":
    # Local testing -- feel free to add your own tests as well!
    print("testing simple_full_packages:")
    print(f"Got {simple_full_packages(10, 0)=}, expected 0")
    print(f"Got {simple_full_packages(10, 3)=}, expected 3")
    print(f"Got {simple_full_packages(5, 5)=}, expected 1")

    print("\ntesting simple_unfulfilled_items:")
    print(f"Got {simple_unfulfilled_items(10, 0)=}, expected 10")
    print(f"Got {simple_unfulfilled_items(10, 3)=}, expected 1")
    print(f"Got {simple_unfulfilled_items(5, 5)=}, expected 0")

    print("\ntesting num_packages:")
    print(f"Got {num_packages(10, 1)=}, expected 10")
    print(f"Got {num_packages(10, 3)=}, expected 4")
    print(f"Got {num_packages(10, 5)=}, expected 2")

    print("\ntesting simple_shipping_days:")
    print(f"Got {simple_shipping_days(5, False)=}, expected 4")
    print(f"Got {simple_shipping_days(3, True)=}, expected 5 - weekday holiday")
    print(f"Got {simple_shipping_days(6, True)=}, expected 6 - Saturday holiday")
    print(f"Got {simple_shipping_days(0, False)=}, expected 5 - Sunday")

    print("\ntesting full_packages:")
    print(f"Got {full_packages(10, 3, 5)=}, expected 0")
    print(f"Got {full_packages(2, 6, 5)=}, expected 0")
    print(f"Got {full_packages(11, 16, 5)=}, expected 2")
    print(f"Got {full_packages(50, 10, 3)=}, expected 3")

    print("\ntesting unfulfilled_items:")
    print(f"Got {unfulfilled_items(10, 3, 5)=}, expected 3")
    print(f"Got {unfulfilled_items(7, 6, 2)=}, expected 0")
    print(f"Got {unfulfilled_items(10, 15, 5)=}, expected 5")
    print(f"Got {unfulfilled_items(50, 10, 3)=}, expected 1")
    

    print("\ntesting shipping_days:")
    print(f"Got {shipping_days(10, 1, False)=}, expected 4")
    print(f"Got {shipping_days(101, 1, False)=}, expected 5 - large delivery bonus")
    print(f"Got {shipping_days(201, 1, False)=}, expected 6 - large delivery bonus")
    print(f"Got {shipping_days(10, 5, True)=}, expected 5 - holiday")
    print(f"Got {shipping_days(10, 6, True)=}, expected 6 - weekend")
    print(f"Got {shipping_days(10, 0, False)=}, expected 5 - weekend")
    print(f"Got {shipping_days(210, 6, True)=}, expected 8 - weekend + large delivery")
