0
callable object in python
''' An array 'a' is divided into two sub arrays 'b' and 'c' such that difference of the sums of elements in the respective sub arrays is minimum e.g a = [2,5,4,7,15,20] b = [20,7,4] c = [15,5,2]''' a = [2,5,4,7,15,20] b = [] c = [] while len(a) != 0: val = a.pop(a.index(a(max))) b.append(val) val = a.pop(a.index(a(max))) c.append(val) print (b) print (c) print (sum(b)-sum(c)) ......please someone fix the error
2 ответов
+ 2
val = a.pop(a.index(a(max)))
👇
val = a.pop(a.index(max(a)))
0
I usually do silly mistakes