Answer to Question #282281 in Python for saikalyan reddy

Question #282281

if the input is :

4 4

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16


then output should be:- 1 2 3 4 8 7 6 5 9 10 11 12 16 15 14 13


1
Expert's answer
2021-12-23T11:10:06-0500
n, m = map(int, input().split())


for i in range(n):
    l = list(map(int, input().split()))
    if i%2==1:
        l.reverse()
        print(*l, end=" ")
    else: print(*l, end=" ")

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