forked from hariom20singh/python-learning-codes
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSorting_List.py
More file actions
Latest commit
18 lines (15 loc) · 556 Bytes
/
Copy pathSorting_List.py
File metadata and controls
18 lines (15 loc) · 556 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#Sorting list in lexicographic order
example_list= ['pineapple','banana','vaaabbbcc','apple','grapes','orange']
print('before Sorting : ',example_list)
example_list.sort()
print('after Sorting : ', example_list)
#sorting list in ascending order
example=[3,5,7,21,5,6,78,4,1,0,4]
print('before Sorting :',example)
example.sort()
print('Sort in Ascending order : ', example)
#sorting list in descending order
example2=[3,5,7,21,5,6,78,4,1,0,4]
print('before Sorting :',example2)
example2.sort(reverse=True)
print('Sort in descending order : ', example2)