[ create a new paste ] login | about

Link: http://codepad.org/iuurOSj5    [ raw code | output | fork ]

Python, pasted on Jun 30:
import math

def seperate(array, divider):
        result = []
        count = math.ceil(float(len(array)) / divider)
        i = 0

        while i < count:
            limit = (i + 1) * divider
            ii = i * divider

            while ii < limit and ii < len(array)
                result += array[ii]
                ii += 1

            i += 1


        return result


array = [1, 2, 3, 4, 5, 6, 7]

seperate(array, 3)


Output:
1
2
3
4
  Line 12
    while ii < limit and ii < len(array)
                                       ^
SyntaxError: invalid syntax


Create a new paste based on this one


Comments: