numpy col slicing
This is the code
import sys import math import numpy as np def encryption(a): square=[] #a="if man was meant to stay on the ground god would have given us roots" a=a.replace(" ","") cols=int(math.sqrt(len(a))) rows=round(len(a)/cols) a=a+" "*int(cols-len(a)%cols) sq=np.reshape(np.array(list(a)),(rows,cols)) s="" for n in range(cols-1): s=s+"".join(sq[:,n])+" " return s
To slice the array
2darray[:,2]
The : means each Row ,2 Col number 2