title: Need help in Radix sort
body: <p>I am having a problem in creating a list 
  I am done with the logic part for radix sort . 
  Here is the code:</p>
  
  <pre><code>import math
  
  a = [4, 15, 7, 3, 6, 22, 45, 82]
  
  a1 = [[] for _ in xrange(len(a))]
  a2 = [[] for _ in xrange(len(a))]
  a3 = [[] for _ in xrange(len(a))]
  a4 = [[] for _ in xrange(len(a))]
  b = [[] for _ in xrange(10)]
  b2 = [[] for _ in xrange(10)]
  d=len(str(max(a)))
  
  
  
  [str(item).zfill(d) for item in a]
  
  print a
  </code></pre>
  
  <p>this part of the code will add zero before the numbers so that length of all the digits will be same as that of no having max no of digit </p>
  
  <p>it gives <code>a = [ 04 , 15 , 07 , 03 , 06 , 22 , 45 , 82 ]</code></p>
  
  <pre><code>for x in xrange(0,len(a)) :
     a1[x].append(a[x]%10)
     print a1 
  
  print '\n'
  </code></pre>
  
  <p>this will save the end digit of each numbers 
  as follows </p>
  
  <pre><code>a1 = [[4], [5], [7], [3], [6], [2], [5], [2]]
  </code></pre>
  
  <p>In the next part ,if bucket no matches with the end digits of the no.
  then the no. having that digit will be stored in it.</p>
  
  <pre><code>i=0
  for x in xrange(0,len(a)) :    
    for u in range(0,len(a)) :
      if a1[u]==[i] :
        b[x].append(a[u])
    i=i+1
  
  
  for u in range(0,len(a)) :
     print b[u] 
  </code></pre>
  
  <p>Output will be as follows :</p>
  
  <pre><code>[]
  []
  [22, 82]
  [3]
  [4]
  [15, 45]
  [6]
  [7]
  </code></pre>
  
  <p>This part will pick up the no. from the bucket starting from bucket no. zero to bucket no. 10</p>
  
  <pre><code>for k in range(0,len(a))  :      
   l=len(b[k])
   for t in range(0,l) :
       a2[k]=b[k][t]
       print a2[k]
  </code></pre>
  
  <p>a2 is</p>
  
  <pre><code>22
  82
  3
  4
  15
  45
  6
  7
  </code></pre>
  
  <p>but when i print it ,like this-</p>
  
  <pre><code>print a2[0]
  </code></pre>
  
  <p>It gives </p>
  
  <pre><code>[]
  </code></pre>
  
  <p>I don't want to store the empty values in that a2 list
  How to avoid it?</p>
  
  <p>I know i have to use condition like "if bucket is empty dont put the no just continue the loop" 
  I dont know how to write code for this.</p>
  
  <p>I guess i need to add </p>
  
  <pre><code>if len(b[k][t])==0 :
         continue
  else :
      a2[k]=b[k][t]
      print a2[k]
  </code></pre>
  
  <p>But it's not working </p>
  
  <pre><code>Traceback (most recent call last):
    File "prog.py", line 39, in &lt;module&gt;
  TypeError: object of type 'int' has no len()
  </code></pre>