see in the for loop we went threw as for each col… in centers… here each_cen is a aray of 3 elements right … like we say as rgb values… now at the last we used a[:,:,:] = each_col means for every a[i][j][k] = each_col… what i think this should had been as a[i][j] = each_col