title: Python: Sort an array
body: <p>I have a class that's sole purpose is to sort an array that's given as a parameter, however first of all, I'm getting an error "int not iterable." My question is what is this error and am I doing my sorting correctly?  Thanks.  Here is my sorter class being called by the other class below.  </p>
  
  <pre><code>class Sorter:
      def reverseWackySort(self, vals):
          i = 0
          j = 0
          temp = 0
          length = len(vals)
          for i in length:
              for j in (length -1):
                  if vals[j] &gt; vals[j+1]:
                      temp = vals[j]
                      vals[j] = vals[j+1]
                      vals[j+1] = temp;
          return vals
  </code></pre>
  
  <p>Code - </p>
  
  <pre><code>from Sorter import Sorter
  
  def TestSorter():
      rws = Sorter()
  
  
      nums = [88, 1, 7, 32, 18, 77, 34, 99, 54, 22]
  
      print "\nBefore Sort: ", nums
  
      rws.reverseWackySort(nums)
  
      print "After Sort:   {}\n".format(nums)
  
  TestSorter()
  </code></pre>