(l, g)
return glist
divide list l among g groups
    each group has either int(len(l)/g) or int(len(l)/g)+1 elements
    returns a list of groups
divide list l among g groups
    each group has either int(len(l)/g) or int(len(l)/g)+1 elements
    returns a list of groups
divide list l among g groups each group has either int ( len ( l ) / g ) or int ( len ( l ) / g ) + 1 elements returns a list of groups
def iid_divide(l, g):
    '''
    divide list l among g groups
    each group has either int(len(l)/g) or int(len(l)/g)+1 elements
    returns a list of groups
    '''
    num_elems = len(l)
    group_size = int(len(l)/g)
    num_big_groups = num_elems - g * group_size
    num_small_groups = g - num_big_groups
    glist = []
    for i in range(num_small_groups):
        glist.append(l[group_size * i : group_size * (i + 1)])
    bi = group_size*num_small_groups
    group_size += 1
    for i in range(num_big_groups):
        glist.append(l[bi + group_size * i:bi + group_size * (i + 1)])
    return glist
def iid_divide ( l , g ) : num_elems = len ( l ) group_size = int ( len ( l ) / g ) num_big_groups = num_elems - g * group_size num_small_groups = g - num_big_groups glist = [ ] for i in range ( num_small_groups ) : glist . append ( l [ group_size * i : group_size * ( i + 1 ) ] ) bi = group_size * num_small_groups group_size += 1 for i in range ( num_big_groups ) : glist . append ( l [ bi + group_size * i : bi + group_size * ( i + 1 ) ] ) return glist