title: Loop to split list in different sublists
body: <p>I want to split one list of number comparing the first number of the sequence with the next one to figure out if it's bigger, in this case we create that sublist till find one number who is smaller. And each other</p>
  
  <pre><code>Inputdata = [45,42,78,120,47,2,50,32,34]
  </code></pre>
  
  <p>compare 45 with 42 is bigger not, so create list just with 45, and start with 42 to compare with the next one till find the smaller than 42:</p>
  
  <pre><code>Output = [45] [42,78,120,47] [2,50,32,34]
  </code></pre>
  
  <p>this is my code:</p>
  
  <pre><code>data = [45,42,78,120,47,2,50,32,34]
  
  m = (len(data))
  i=0
  list1=[]
  emptylist = True
  while i &lt;= m:
  
   for j in range(i+1,len(data)-1):
  
  
      if data[i] &lt; data[j]:
          list1.append(data[j])
          emptylist = False
  
      else:
  
          if emptylist:
  
              list1.insert(0,data[i])
              print list1
              i += j
              list1 = []
              emptylist = True
              break
  
          else:
              list1.insert(0,data[i])
              print list1
              print j
              i += j
              print i
              list1 = []
              emptylist = True
              i += j
              break
  </code></pre>
  
  <p>My Output is:</p>
  
  <pre><code>[45]
  [42, 78, 120, 47]
  </code></pre>
  
  <p>and I can't find the problem... any suggestions? thanks</p>
  
  <p>PD1. The idea is create sublist where the first element is the smaller one.</p>