Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello, I need help for this python code. Thanks in advance recipes = { small: { ingredients: { bread: 2, ## slice ham: 4, ##
Hello, I need help for this python code. Thanks in advance
recipes = { "small": { "ingredients": { "bread": 2, ## slice "ham": 4, ## slice "cheese": 4, ## ounces }, "cost": 1.75, }, "medium": { "ingredients": { "bread": 4, ## slice "ham": 6, ## slice "cheese": 8, ## ounces }, "cost": 3.25, }, "large": { "ingredients": { "bread": 6, ## slice "ham": 8, ## slice "cheese": 12, ## ounces }, "cost": 5.5, } } resources = { "bread": 12, ## slice "ham": 18, ## slice "cheese": 24, ## ounces } ### Complete functions ### class SandwichMachine: def __init__(self, machine_resources): """Receives resources as input. Hint: bind input variable to self variable""" self.machine_resources = machine_resources def check_resources(self, ingredients): """Returns True when order can be made, False if ingredients are insufficient.""" def process_coins(self): """Returns the total calculated from coins inserted. Hint: include input() function here, e.g. input("how many quarters?: ")""" def transaction_result(self, coins, cost): """Return True when the payment is accepted, or False if money is insufficient. Hint: use the output of process_coins() function for cost input""" def make_sandwich(self, sandwich_size, order_ingredients): """Deduct the required ingredients from the resources. Hint: no output""" ### Make an instance of SandwichMachine class and write the rest of the codes ###
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started