Using Python Solve Last 2 Issues Doc Test Passes Idk Im Wrong Plz Help Def Supplier Ingred Q37068094

using python solve the last 2 issues so that the doc test passesidk what im doing wrong plz help.

def supplier(ingredients, chef):

for ingredient in ingredients:

try:

chef.send(ingredient)

except StopIteration as e:

print(e)

break

chef.close()

def customer():

served = False

while True:

try:

dish = yield

print(‘Yum! Customer got a {}!’.format(dish))

served = True

except GeneratorExit:

if not served:

print(‘Customer never got served.’)

raise

def chef(customers, dishes):

“””

>>> cust = customer()

>>> next(cust)

>>> c = chef({cust: ‘hotdog’}, {‘hotdog’: [‘bun’,’hotdog’]})

>>> next(c)

>>> supplier([‘bun’, ‘hotdog’], c)

Yum! Customer got a hotdog!

Chef went home.

>>> cust = customer()

>>> next(cust)

>>> c = chef({cust: ‘hotdog’}, {‘hotdog’: [‘bun’,’hotdog’]})

>>> next(c)

>>> supplier([‘bun’], c)

Chef went home.

Customer never got served.

>>> cust = customer()

>>> next(cust)

>>> c = chef({cust: ‘hotdog’}, {‘hotdog’: [‘bun’,’hotdog’]})

>>> next(c)

>>> supplier([‘bun’, ‘hotdog’, ‘mustard’], c)

Yum!

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.