Hello, there is a function, part of which is presented below, which should calculate the difference between the elements of the list g and the lists, which are values of the ang dictionary, and output the output in the form:
{'linear':[разница],'bent':[разница]} code itself:
g = [132] ang = {'linear':[180],'bent':[120]} for k in ang: for i in g: for x in ang[k]: dict = {k: round(100*sum([abs(ix)])/sum(g)) for k,ang[k] in ang.items()} return(dict) however, only this is printed:
{'linear':[36],'bent':[36]} although the answer would be considered correct:
{'linear':[36],'bent':[9]} that is, it is considered only for linear, but not for bent
in all cases the number of elements g and the number of elements in the lists of the dictionary are the same
g,angobtained. Do not use broken code as a task specification. - jfs