Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2addb4c

Browse files
added sort list
1 parent af44a00 commit 2addb4c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎Day 2/sort-list.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
arr = list(map(int, input('Enter a list: ').split()))
2+
l = len(arr)
3+
4+
arr_left = arr[:l//2]
5+
arr_right = arr[l//2:]
6+
7+
arr_left.sort()
8+
arr_right.sort(reverse=True)
9+
10+
arr_sorted = arr_left + arr_right
11+
print(arr_sorted)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /