List Replace

You are required to deliver the following function in the module list_replace (file list_replace.py):

list_replace(Ls, c1, c2)

such that

given

modifies Ls by having all ocurrences of c1 replaced by c2 in all strings in Ls up to the first string where c1 does not occur.

and returns an int with the sum of all replacements done.

For example:


>>> L = ['abba', 'Adela', 'ell ella allaell', 'La Lola']
>>> n = list_replace(L, 'a', 'o')
>>> n == 8 and L == ['obbo', 'Adelo', 'ell ello olloell', 'Lo Lolo']
True

>>> L = ['abba', 'Adela', 'bubu', 'ell ella allaell', 'La Lola']
>>> n = list_replace(L, 'a', 'o')
>>> n == 3 and L == ['obbo', 'Adelo', 'bubu', 'ell ella allaell', 'La Lola']
True

>>> L = ['abba', 'Adela', 'ell ella allaell', 'La Lola']
>>> n = list_replace(L, 'e', 'i')
>>> n == 0 and L == ['abba', 'Adela', 'ell ella allaell', 'La Lola']
True



Doctests are available in the list_replace.test file.