You are given a list of orders of articles, and a list containing for each article which store provides it. Costumers can buy multiple items, and a store can provide multiple items, but an item can only be provided by one store.
Your job is to count for each store how many times each article has been ordered.
Write a Python function getOrderedArticles(articles: list, orders: list)
that takes a list of articles and a list of orders as input.
articles
contains a list of tuples, where every tuple consists of an article and a storeorders
contains a list of tuples, where every tuple consists of an costumer and an articleThis function needs to return a dictionary, containing the number of times each article has been ordered per store.
Caution: If an article has not been ordered by any costumer, it should not be shown in the result.
>>> getOrderedArticles([("Tomatoes","Makro"),("Milk","Delhaize"),("Flour","Makro"),("Eggs","Delhaize")],[("Mike","Flour"),("Pieter","Tomatoes"),("Julie","Milk"),("Seppe","Milk")])
{'Makro': {'Tomatoes': 1, 'Flour': 1}, 'Delhaize': {'Milk': 2}}