title: sort random list of numbers into groups based on range
body: <p>Thanks in advance for any advice!
  I have a random group of numbers that need to be sorted into groups based on their range... I could use some advice how to do this...thanks in advance</p>
  
  <p>So, I imagine the code works like this:
  Take a list of 100 random numbers ranging from 0-1000
  Split the range (from 0-1000) into x number of groups (say 10 groups: 0-100,100-200, 200-300 etc...)
  For i in this list
  test if its in group 1
  if true add this to a list
  if not test consecutive groups</p>
  
  <p>the thing is the  number of groups should be a variable that can be adjusted and the subsequent lists should be updated accordingly to the division of the range... </p>
  
  <pre><code>import random as r
  #create list of random integers
  ranInteger = []
  
  #length of list of random integers
  for i in range (10):
      ranInt = r.randint(0,1000)
      ranInteger.append(ranInt)
  print "ranInteger =", ranInteger
  
  #find bounds of random list of integers
  maxL = max(ranInteger)
  minL = min(ranInteger)
  print "maxL =", maxL
  print "minL =", minL  
  
  #find range of random list of integers
  rangeL = maxL - minL
  print "rangeL =", rangeL 
  
  #divide range to create grouping value
  divRange = 10
  grpValue = (rangeL / divRange)
  print "grpValue =", grpValue 
  
  #make List of grouping values
  grpL =[] 
  r2 = range (minL, maxL, int (grpValue))
  grpL.append (r2)
  print "grpL =", grpL
  
  #tests each number
  indexl = []
  for j in ranInteger:
      #test each range
      if i &gt;= ranInteger[s] and i&lt; ranInteger [s+1]) or (s==0)):
  print indexl
  #to be honest I have no idea how to sort this list into different groups
  #and to have the lists with groups update if the group division is changed 
  #how can I dynamically create lists based on the value of other objects?
  #so i can say divRange = 10 make 10 lists with values grouped in there 
  #but if the user changes this divRange = 20 then it automatically makes 20 
  #lists with new groups contained within
  # I would also like these same lists but with the index of the grouped items 
  </code></pre>
  
  <p>instead of the actual number</p>
  
  <p>thank you!!! - E</p>