Average Mask 2

Implement the following Python function in the module mask_avg2 (file mask_avg2.py):

mask_avg2(l, l2, l3)

such that

given l, l2, l3 lists of float with same length

modifies l by replacing every value v by the average of the two values placed in the same position in 12 and l3, but only when this value is bigger than v. The new value must be rounded to 1 decimal.

For example:


>>> l = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
>>> l2 = [1.0, 3.0, 2.5, 6.2, 4.8, 8.1]
>>> l3 = [0.0, 0.2, 0.4, 0.3, 0.5, 0.1]
>>> mask_avg2(l, l2, l3)
>>> l
[0.5, 1.6, 1.4, 3.2, 2.6, 4.1]


>>> l = [2.0, 2.0, 2.0, 2.0, 2.0, 2.0]
>>> mask_avg2(l, l2, l3)
>>> l
[2.0, 2.0, 2.0, 3.2, 2.6, 4.1]

Doctests are available at the mask_avg2-test.txt file.