Average Mask

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

mask_avg(L, Lmask)

such that

given L, Lmask lists of float with same length.

modifies L by replacing every value by the average of this value and the value placed in the same position in Lmask. The new value must be rounded to 1 decimal.

For example:


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

>>> l =     [1.0, 3.0, 2.5, 6.2, 4.8, 8.1]
>>> lmasc = [-1.0, -3.0, -2.5, -6.2, -4.8, -8.1]
>>> mask_avg(l, lmasc)
>>> l
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

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