title: Debugging a function that tries to merge two strings but sometimes does not return
body: <p>The function is supposed to return True if the parameter s can be formed solely from the parameters part1 and part2, and returns False otherwise. My function works when it is supposed to return True, but when False, it doesn't return anything at all.</p>
  
  <pre><code>def is_merge(s, part1, part2):
    list = []
    v1 = 0
    v2 = 0
    i = 0
    while i &lt; len(s):
        if v1 &lt; len(part1) and s[i] == part1[v1]  :
            list.append(s[i])
            i += 1
            v1 += 1
        elif v2 &lt; len(part2) and s[i] == part2[v2] :
            list.append(s[i])
            i += 1
            v2 += 1
    list = ''.join(list)
    if list == s:
        return True
    else:
        return False
  
  right = (is_merge('codewars', 'cdw', 'oears'))
  wrong = (is_merge('codewarse', 'cdw', 'oears'))
  
  if right == True:
    print("true")
  
  if wrong == False:
    print("false")
  </code></pre>