def shared_values(set_list): ''' Arguments: set_list: a list of sets Returns: A set of the items that exist in all of the given sets ''' pass def test_shared_values(): ''' Contains the tests in the problem definition. FEEL FREE TO ADD YOUR OWN. ''' expecteds = [{1}, set(), {1, 2, 3}] actuals = [ shared_values([{1}, {1, 2}, {1, 2, 3}]), shared_values([]), shared_values([{1, 2, 3}]) ] for expected, actual in zip(expecteds, actuals): assert expected == actual, \ f'Failed: Expected {expected}, but received {actual}' def strongest_pokemon(pokemon_list): ''' Arguments: pokemon_list: a list of dictionaries, representing the power levels and names of various pokemon. Returns: A dictionary of attribute (keys) pointing to a tuple with the name and value of the pokemon with the highest of that attribute. ''' pass def test_strongest_pokemon(): ''' Contains the tests in the problem definition. FEEL FREE TO ADD YOUR OWN. ''' example_list = [ {"name": "Pikachu", "strength": 40, "speed": 70, "defense": 5}, {"name": "Charizard", "strength": 120, "speed": 50, "defense": 80}, {"name": "Meowth", "strength": 30, "speed": 40, "defense": 10} ] expected = { "strength": ("Charizard", 120), "speed": ("Pikachu", 70), "defense": ("Charizard", 80) } actual = strongest_pokemon(example_list) assert expected == actual, \ f'Failed: Expected {expected}, but received {actual}' def best_veggie_value(market, quantities): ''' Arguments: market: a dictionary of dictionaries. Keys are stand names. Values (inner dictionaries) are the items this stand sells, as well as the stand's discount thresholds. quantities: a dictionary of item names as keys with the desired quantities as values. Returns: A new dictionary, keys are stand names and values are a list of items. ''' pass def test_best_veggie_value(): ''' Contains the tests in the problem definition. FEEL FREE TO ADD YOUR OWN. ''' example_market = { "Paul's Produce": { "bulk_discount_quantity": 10, "bulk_discount_percent": 0.15, "bananas": 1.25, "carrots": 3.25, "potatoes": 80.0 }, "Gretchen's Groceries": { "bulk_discount_quantity": 15, "bulk_discount_percent": 0.30, "bananas": 1.05, "carrots": 4.0 }, } example_quantities = { "bananas": 10, "carrots": 50, "potatoes": 2 } expected = { "Gretchen's Groceries": ["bananas"], "Paul's Produce": ["carrots", "potatoes"] } actual = best_veggie_value(example_market, example_quantities) assert expected == actual, \ f'Failed: Expected {expected}, but received {actual}' def main(): test_shared_values() test_strongest_pokemon() test_best_veggie_value() if __name__ == '__main__': main()