0 like 0 dislike
69 views
in Examples, Exercises and Projects by Goeduhub's Expert (7.8k points)

Input:
8
2 4 7 9 3 1 6 8


Output:
1 2 3 4 9 8 7 6

1 Answer

0 like 0 dislike
by Goeduhub's Expert (7.8k points)
 
Best answer

a=int(input())

b=input()

b=b.split(" ")

n_list=[]

           b.sort()

for i in range(a//2):

     n_list.append(int(b[i]))

for i in range(-1,(-a//2)-1,-1):

    n_list.append(int(b[i]))

print(n_list)

...