Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

could any one show me how could sort an array

+2 votes
asked May 16, 2019 by anonymous

2 Answers

0 votes
answered May 16, 2019 by anonymous
let u take a arr[]={14,3,2,10,9};

now the first element in the loop will be compared to the each and every element then with the comparisons u will sort that
0 votes
answered May 20, 2019 by Vijay

list=[2,4,5,7,8,3,9,8]

list.sort()    #if Ascending 

list.sort(reverse=True) #if Descending

print(list)

output:

[2,3,4,5,6,7,8,9]    #if Ascending 

[9,8,7,6,5,4,3,2]    #if Descending

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...