27 lines
679 B
Python
27 lines
679 B
Python
def maximum_value(maximum_weight, items):
|
|
#всі перевірки на перші 2 тести
|
|
if maximum_weight == 0:
|
|
return 0
|
|
if items == 0 or items is None or items ==[]:
|
|
return 0
|
|
if len(items) == 1:
|
|
curent_dic = items[0]
|
|
weight = curent_dic.get("weight")
|
|
if weight > maximum_weight:
|
|
return 0
|
|
#ділимо на лісти
|
|
weight = []
|
|
value = []
|
|
i = 0
|
|
while i < len(items):
|
|
curent_dic = items[i]
|
|
weight.append(curent_dic.get("weight"))
|
|
value.append(curent_dic.get("value"))
|
|
i +=1
|
|
|
|
|
|
|
|
|
|
def maximum_value_with_items(maximum_weight, items):
|
|
pass
|