Python - replace multiple characters without .replace()
<p>The task is to transform any string into any string without built-in <code>.replace()</code>. I failed because I forgot that technically space is also a string character. Firstly I transformed this string into the list, but now I see I did it unnecessarily. However, it still doesn't work.</p>

<ol>
<li>I can replace "cat" into "dog"</li>
<li>I can replace "c" into "dog"</li>
</ol>

<p>I can't replace "a cat" into "a dog".</p>

<p>I tried with <code>lambda</code> or <code>zip</code>, but I don't really know how to do it. Do you have any clue?</p>

<pre><code>string = "Alice has a cat, a cat has Alice."
old = "a cat"
new = "a dog"

def rplstr(string,old,new):
    """ docstring"""

    result = ''
    for i in string:
        if i == old:
            i = new
        result += i
    return result

print rplstr(string, old, new)
</code></pre>