Question: Coding in Python. I keep receiving the error code for this function when running my test: self.assertEqual(4.5, buy_food(7.5)) File /Users/Documents/amusement_park.py, line 97, in buy_food order
Coding in Python. I keep receiving the error code for this function when running my test:

self.assertEqual(4.5, buy_food(7.5))
File "/Users/Documents/amusement_park.py", line 97, in buy_food
order = input('What would you like?')
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/mock.py", line 939, in __call__
return _mock_self._mock_call(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/mock.py", line 998, in _mock_call
result = next(effect)
StopIteration
def buy_food (money): Note: the food menu you should print out is provided for you. Make sure to use these specific prices when you are subtracting from the user's money. When you are getting input from the user to ask if they would like to continue ordering, make sure their answer is in the format 'y' for yes and 'n' for no. Allows the user to buy some food if they have enough money. Ask the user for an order until they say no or until they can't pay. Parameters: money an int representing how much money the user has Returns: - The amount of money the user has after the transaction num_hotdog0 num-burger = 0 num_soda0 print('hotdog: 1.00 nburger: 2.00 soda: 0.50') print ( 'What would you like?') print('hotdog burger nsoda Done') while True: print('current order:','In',"-hotdog:", num_hotdog, 'In', '-burger:',num_burger, 'In' '-Soda:', num_soda) cost num_hotdog 1 and num_burger * 2 and num_soda * 0.5 order input('hat would you like?') if order = 'Hotdog'; how-many-int(input ('How many would you like?')) num_hotdog +how_many elif order == "Burger': how many = int(input ('How many would you like?')) num burger-how many elif order-('Soda'): how_many int(input( 'how many would you like?')) num-soda += how many "Done': can_pay (money, cost): elif order if print('Have a nice day') return money cost else: print('sorry you don\'t have enough money!') return money else: print('sorry we don\'t have that')
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
