diff --git a/Python/Get Kth Column of Matrix.py b/Python/Get Kth Column of Matrix.py new file mode 100644 index 0000000..2b66bd3 --- /dev/null +++ b/Python/Get Kth Column of Matrix.py @@ -0,0 +1,14 @@ +test_list = [[4, 5, 6], [8, 1, 10], [7, 12, 5]] + +# printing original list +print("The original list is : " + str(test_list)) + +# initialize K +K = 2 + +# Get Kth Column of Matrix +# using zip() +res = list(zip(*test_list)[K]) + +# printing result +print("The Kth column of matrix is : " + str(res))