Python/mecha-munch-management/send-to-store: what is wrong with my code?

def send_to_store(cart, aisle_mapping):
    """Combine users order to aisle and refrigeration information.

    :param cart: dict - users shopping cart dictionary.
    :param aisle_mapping: dict - aisle and refrigeration information dictionary.
    :return: dict - fulfillment dictionary ready to send to store.
    result = {item : aisle_mapping[item].insert(0, cart[item]) for item in cart.keys()}
    new = dict(sorted(result.items()))                 
    return dict(reversed(new.items()))

I do not understand what is wrong with my solution that it gives None, instead of the values of dictionary.
I want to insert an element from cart values in the mapping value that is in form of list. I tried slightly different solutions.

list.insert() returns None. You don’t want to use the return value from that function.

1 Like