Answer to Question #312232 in Python for siva

Question #312232

Combined right angle triangle:


Sample input: 4


1st half:


1 2 3 4

5 6 7

8 9

10


2nd half:


17 18 19 20

14 15 16

12 13

11


Output should be combined pattern:


Combined pattern:


1 2 3 4 17 18 19 20

5 6 7 14 15 16

8 9 12 13

10 11


1
Expert's answer
2022-03-15T16:46:05-0400
n = int(input())


print("1st half:")
tr1 = []
for i in range(n):
    line = input()
    row = [int(s) for s in line.split()]
    tr1.append(row)


print()
print("2nd half:")
tr2 = []
for i in range(n):
    line = input()
    row = [int(s) for s in line.split()]
    tr2.append(row)


tr = []
for i in range(n):
    row = tr1[i] + tr2[i]
    tr.append(row)


print("Combined pattern:")
for row in tr:
    for x in row:
        print(x, end=' ')
    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