title: 'NoneType' object is not iterable - looping w/returned value
body: <p>The purpose of this code is to find the longest string in alphabetical order that occurs first and return that subset.  </p>
  
  <p>I can execute the code once, but when I try to loop it I get 'NoneType' object is not iterable (points to last line).  I have made sure that what I return and input are all not of NoneType, so I feel like I'm missing a fundamental.  </p>
  
  <p>This is my first project in the class, so the code doesn't need to be the "best" or most efficient way - it's just about learning the basics at this point.</p>
  
  <pre><code>s = 'efghiabcdefg'
  best = ''
  comp = ''
  temp = ''
  
  def prog(comp, temp, best, s):
      for char in s:
          if comp &lt;= char: #Begins COMParison of first CHARacter to &lt;null&gt;
              comp = char  #If the following character is larger (alphabetical), stores that as the next value to compare to.
              temp = temp + comp  #Creates a TEMPorary string of characters in alpha order.
              if len(temp) &gt; len(best):  #Accepts first string as longest string, then compares subsequent strings to the "best" length string, replacing if longer.
                  best = temp
              if len(best) == len(s):  #This is the code that was added...
                  return(s, best)  #...to fix the problem.  
          else:
              s = s.lstrip(temp)  #Removes those characters considered in this pass
              return (str(s), str(best)) #Provides new input for subsequent passes
  
  while len(s) != 0:
      (s, best) = prog(comp, temp, best, s)
  </code></pre>