Online Courses
Free Tutorials  Go to Your University  Placement Preparation 
Goeduhub's Online Courses @ Udemy in Just INR 570/-
Online Training - Youtube Live Class Link
0 like 0 dislike
1.5k views
in Python Programming by Goeduhub's Expert (8.3k points)

Input:
8
2 4 7 9 3 1 6 8


Output:
1 2 3 4 9 8 7 6

Goeduhub's Top Online Courses @Udemy

For Indian Students- INR 570/- || For International Students- $12.99/-

S.No.

Course Name

 Coupon

1.

Tensorflow 2 & Keras:Deep Learning & Artificial Intelligence

Apply Coupon

2.

Natural Language Processing-NLP with Deep Learning in Python Apply Coupon

3.

Computer Vision OpenCV Python | YOLO| Deep Learning in Colab Apply Coupon
    More Courses

1 Answer

0 like 0 dislike
by Goeduhub's Expert (8.3k 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)

3.3k questions

7.1k answers

393 comments

4.5k users

 Goeduhub:

About Us | Contact Us || Terms & Conditions | Privacy Policy || Youtube Channel || Telegram Channel © goeduhub.com Social::   |  | 
...