title: Python: can a function return a string?
body: <p>I am making a recursive function that slices string until it is empty. When it is empty it alternatively selects the characters and is supposed to print or return the value. In this case I am expecting my function to return two words 'Hello' and 'World'. Maybe I have got it all wrong but what I don't understand is that my function doesn't let me print or return string. I am not asking for help but I'd like some explanation :) thanks</p>
  
  <pre><code>def lsubstr(x):
      a= ''
      b= ''
      if x == '':
          return ''
      else:
          a = a + x[0:]
          b = b + x[1:]
          lsubstr(x[2:])
          #print (a,b)
          return a and b
  
  lsubstr('hweolrllod')
  </code></pre>
  
  <p>so I changed my code to this:</p>
  
  <pre><code>def lsubstr(x):
  
  if len(x) &lt;1:
          return x
  else:
          return (lsubstr(x[2:])+str(x[0]),lsubstr(x[2:])+str(x[1]))
  lsubstr('hweolrllod')
  </code></pre>
  
  <p>and what I am trying to make is a tuple which will store 2 pairs of characters and concatenate the next ones,</p>
  
  <p>the error I get is 
  TypeError: Can't convert 'tuple' object to str implicitly</p>
  
  <p>what exactly is going wrong, I have checked in visualization, it has trouble in concatenating.</p>