import numpy as np
matrix = [
[1,2,3,4],
[5,6,7,8],
[9,10,11,12]
]
m1 = np.append(matrix,[[1,1,1,1]],axis=0)
print('>>>>m1>>>>\n',m1)
m2 = np.append(matrix,[[1],[1],[1]],axis=1)
print('>>>>m2>>>>\n',m2)
m3 = np.append(matrix,[1,1,1,1])
print('>>>>m3>>>>\n',m3)
>>>>m1>>>>
[[ 1 2 3 4]
[ 5 6 7 8]
[ 9 10 11 12]
[ 1 1 1 1]]
>>>>m2>>>>
[[ 1 2 3 4 1]
[ 5 6 7 8 1]
[ 9 10 11 12 1]]
>>>>m3>>>>
[ 1 2 3 4 5 6 7 8 9 10 11 12 1 1 1 1]