The function is called def expand_fmla (original)
The input variable to this function, original, is a string with a specific format: the first two positions in original have the symbols *
or +
, hence there are 4 possibilities for the first two positions of original: ++, **, +*
and *+
. The subsequent positions have digits, at least 3 of them (0 to 9), possibly including repetition.
This function should return a formula which has the same digits and in the same order as in the original formula, and in between the digits the two operation symbols are alternatingly included.
For example:
expand_fmla('++123') should return '1+2+3'
expand_fmla('+*1234') should return '1+2*3+4'
expand_fmla('*+123456') should return '1*2+3*4+5*6'
How can I do this, I do not understand???