From 1e22eff41f6113dc9478e8ec2e43a1f4b3d8f038 Mon Sep 17 00:00:00 2001 From: Pragati Kalra <43950367+Pragati-Kalra@users.noreply.github.com> Date: Tue, 26 Oct 2021 20:03:45 +0530 Subject: [PATCH] Create Get Kth Column of Matrix.py --- Python/Get Kth Column of Matrix.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Python/Get Kth Column of Matrix.py 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))