I need a function compara_listas(lista1, lista2)
that receives two random lists and computes the sum of the difference between the elements of them. However, if any element of lista2
is greater than lista1
, it will become negative, and it must be positive.
As 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, (12.81 - 22.22)
and (2.16 - 3.41)
would be negative. So I would need to multiply by -1 to make it positive. How to do this without changing the others?