3
I need a function compara_listas(lista1, lista2)
which receives two random lists and calculates the sum of the difference between their elements. But if any element of the lista2
is greater than the lista1
, it’s going to be negative, and it needs to be positive.
For example:
(lista1 = [4.34, 0.05, 0.02, 12.81, 2.16, 0.0], lista2 = [3.96, 0.05, 0.02, 22.22, 3.41, 0.0])
For example the (12.81 - 22.22)
and the (2.16 - 3.41)
would be negative. Then I would need to multiply by -1 to make it positive. How to do this without changing the others?
Apparently solved the problem. Thanks for your help!
– Eduardo Oliveira
People, be like @Anderson and explain what they’re doing when they answer the questions. Especially on one Liners. : -) +1
– jsbueno