-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #152 from Shruti44328/main
Add files via upload
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Python3 code to demonstrate working of | ||
# Vertical Concatenation in Matrix | ||
# Using loop | ||
|
||
# initializing lists | ||
test_list = [["Gfg", "good"], ["is", "for"], ["Best"]] | ||
|
||
# printing original list | ||
print("The original list : " + str(test_list)) | ||
|
||
# using loop for iteration | ||
res = [] | ||
N = 0 | ||
while N != len(test_list): | ||
temp = '' | ||
for idx in test_list: | ||
|
||
# checking for valid index / column | ||
try: temp = temp + idx[N] | ||
except IndexError: pass | ||
res.append(temp) | ||
N = N + 1 | ||
|
||
res = [ele for ele in res if ele] | ||
|
||
# printing result | ||
print("List after column Concatenation : " + str(res)) |