0
def add_by_price(min_price,max_price,items,cart):
        matched_list=[]
        for price in items:
                product_name,product_price=price.split(',')
                if min_price<=float(product_price)<=max_price:
                        matched_list=product_name+'-'+product_price
                        return matched_list
jasonharper
  • 9,450
  • 2
  • 18
  • 42
  • You're returning the first matching item as soon as you find it. You need to append the matches to your list (rather than simply overwriting it), and return that *after* the loop is finished. – jasonharper Oct 21 '22 at 01:03

0 Answers0