Fatal error

Report a typo

Dave got a job as junior programmer in a food delivery company. He implements the binary search to find out the cost of the order, but something goes wrong, so buyers received incorrect bills.

Help Dave to correct a mistake in the code!

Sample Input 1:

Coca Cola 1l.

Sample Output 1:

3$
Write a program in Python 3
from bisect import bisect

food_menu = [('Coca Cola 1l.', '3$'),
('Fish and chips', '7$'),
('Hamburger', '3.5$'),
('Pizza', '5$')]

food, price = zip(*food_menu)

user_food = input('Select product')
food_id = bisect(food, user_food)
print(price[food_id])
___

Create a free account to access the full topic