It is actually simple.
Say
s = "bubble gum"
and
t = "turtle ham"
.
You should perform an iteration. At step
n you have to take
- The n-prefix of
s
, that is the left part of s
before the nth item. - The nth item of
t
. - The n-suffix of
s
, that is the right part of s
after the nth item.
and concatenate them.
this in
Pythonese translates to
s = s[:i] + t[i:i+1] + s[i+1:]