This commit is contained in:
Marege 2026-12-01 14:40:38 +01:00
parent dcc6f0811f
commit 39318b5acb

View File

@ -1,4 +1,5 @@
def maximum_value(maximum_weight, items):
#всі перевірки на перші 2 тести
if maximum_weight == 0:
return 0
if items == 0 or items is None or items ==[]:
@ -8,6 +9,17 @@ def maximum_value(maximum_weight, items):
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):