Gerard Flanagan wrote:
> SpreadTooThin wrote:
> > I have a list and I need to do a custom sort on it...
> >
> > for example:
> > a = [1,2,3,4,5,6,7,8,9,10] #Although not necessarily in order
>
> > 1 4 7 10
> > 2 5 8
> > 3 6 9
> >
>
> from math import sqrt
>
> for i in range(2,12):
>     seq = range(1,i)
>     numcols = int(sqrt(len(seq)))
>     print columnise(seq, numcols)
> 

should be:

  numcols = int(sqrt(len(seq) + 0.5)


Gerard

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to