Q. Write a program that reverses a 2d array of integers , implemented as nested list, in the order of 0th element of every inner list.



Answer =


a = eval(input ("Enter the list :- "))
for i in range (len(a)):
    for j in range(len(a)-1):
        if (a [ j][0]  ) >(a [ j + 1] [0]) :
            a [ j][0]  , a [ j + 1][0]  = a [ j + 1][0]  , a [ j][0]
print(a)



Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post