Answer to Question #320741 in Python for sandhya

Question #320741

CONCATENATION GAME:

Sameer is playing a game. To win that game he has to combine the list of strings vertically(column wise) and present the final answer in that pattern.

input:

The first line of input contains an integer N that denotes the number of lists to combine

Each of the next N lines of the input contains strings separated by space.

i/p:

1

Hy

o/p:Hy


i/p:

2

by by

hy hy

o/p:

byhy

byhy

i/p:2

by hy

hy

o/p:

byhy

hy


i/p:3

Not you kid

They are got

Like great

o/p:

NotTheyLike

youaregreat

kidgot



1
Expert's answer
2022-03-31T06:06:15-0400
n = int(input("Input n: "))
strings = []
for i in range(n):
    str = input().split()
    strings.append([])
    for j in range(len(str)):
        strings[i].append(str[j])
temp = 0
j = 0
while temp == 0:
    temp = 1
    for i in range(n):
        if j < len(strings[i]):
            temp = 0
            print(strings[i][j], end="")
    j += 1
    print()

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS