Thank you all for your response. somewhere i used your suggestion and now i had solved it by same approach with different implementation.
here is my code :
class Rest_Menu():
def __init__(self, menu):
self.menu = menu
self.all_price = []
def min_price(self, order, total_price=0):
"""
Return minm menu price by calculating all possible combination.
"""
if order:
for item, price in self.menu.iteritems():
if isSubset(order[0], item):
new_order = [each for each in order]
for itm in item:
try:
new_order.remove(itm)
except ValueError:
pass
self.min_price(new_order, price+total_price)
else:
self.all_price.append(total_price)
return min(self.all_price)
Thanks again. :)