1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from pprint import pprint
from typing import List, Tuple
from z3 import *
def find_all_orders(menu_items: List[Tuple[str, int]],
goal_price: int) -> List[List[Tuple[str, int]]]:
"""Find all orders that cost exactly the goal price, given the menu.
Inspired by https://xkcd.com/287/.
Args:
menu_items (List[Tuple[str, int]]): A list of all menu items and their
prices. Assume that all prices are positive.
goal_price (int): Desired exact amount to spend.
Returns:
List[List[Tuple[str, int]]]: A list of all orders that cost exactly the
goal price. Items not ordered are present with amount 0.
"""
pass
# TODO: Implement me!
if __name__ == '__main__':
pass
# You can uncomment the below test cases to try out your implementation,
# or add your own scenarios.
# xkcd_menu = [
# ('mixed_fruit', 215),
# ('french_fries', 275),
# ('side_salad', 335),
# ('hot_wings', 355),
# ('mozz_sticks', 420),
# ('sampler_plate', 580),
# ]
# goal_price = 1505
# pprint(find_all_orders(xkcd_menu, goal_price))
# red_door_menu = [
# ('avocado_toast', 625),
# ('blue_salad', 725),
# ('chicken_sandwich', 750),
# ('coffee', 230),
# ('mocha', 460),
# ('latte', 400),
# ('hot_chocolate', 300),
# ('chai', 350),
# ('cold_coffee', 500),
# ('brain_freeze', 525)
# ]
# goal_price = 1315
# pprint(find_all_orders(red_door_menu, goal_price))
# chouse_menu = [
# ('quesadilla', 100),
# ('chicken_nuggets', 300),
# ('burger', 400),
# ('boba', 150),
# ('tofu_nuggets', 150),
# ('fries', 150),
# ('special', 500),
# ('soda', 100),
# ]
# goal_price = 1025
# pprint(find_all_orders(chouse_menu, goal_price))