44def create_inventory (items ):
55 """Create a dict that tracks the amount (count) of each element on the `items` list.
66
7- :param items: list - list of items to create an inventory from.
8- :return: dict - the inventory dictionary.
7+ Parameters:
8+ items (list): Items to create an inventory from.
9+
10+ Returns:
11+ dict: The inventory dictionary.
912 """
1013
1114 inventory = {}
@@ -16,9 +19,12 @@ def create_inventory(items):
1619def add_items (inventory , items ):
1720 """Add or increment items in inventory using elements from the items `list`.
1821
19- :param inventory: dict - dictionary of existing inventory.
20- :param items: list - list of items to update the inventory with.
21- :return: dict - the inventory updated with the new items.
22+ Parameters:
23+ inventory (dict): Dictionary of existing inventory.
24+ items (list): List of items to update the inventory with.
25+
26+ Returns:
27+ dict: The inventory updated with the new items.
2228 """
2329
2430 for item in items :
@@ -30,9 +36,12 @@ def add_items(inventory, items):
3036def decrement_items (inventory , items ):
3137 """Decrement items in inventory using elements from the `items` list.
3238
33- :param inventory: dict - inventory dictionary.
34- :param items: list - list of items to decrement from the inventory.
35- :return: dict - updated inventory with items decremented.
39+ Parameters:
40+ inventory (dict): Inventory dictionary.
41+ items (list): List of items to decrement from the inventory.
42+
43+ Returns:
44+ dict: Updated inventory with items decremented.
3645 """
3746
3847 for item in items :
@@ -44,9 +53,12 @@ def decrement_items(inventory, items):
4453def remove_item (inventory , item ):
4554 """Remove item from inventory if it matches `item` string.
4655
47- :param inventory: dict - inventory dictionary.
48- :param item: str - item to remove from the inventory.
49- :return: dict - updated inventory with item removed. Current inventory if item does not match.
56+ Parameters:
57+ inventory (dict): Inventory dictionary.
58+ item (str): Item to remove from the inventory.
59+
60+ Returns:
61+ dict: Updated inventory with item removed. Current inventory if item does not match.
5062 """
5163
5264 if item in inventory :
@@ -57,8 +69,11 @@ def remove_item(inventory, item):
5769def list_inventory (inventory ):
5870 """Create a list containing only available (item_name, item_count > 0) pairs in inventory.
5971
60- :param inventory: dict - an inventory dictionary.
61- :return: list of tuples - list of key, value pairs from the inventory dictionary.
72+ Parameters:
73+ inventory (dict): An inventory dictionary.
74+
75+ Returns:
76+ list[tuple]: List of key, value tuples from the inventory dictionary.
6277 """
6378
6479 output = []
0 commit comments