What do you want to save?
Add Code snippet
New code examples
-
Python 2022-02-01 22:07:03
list sort python
my_list = [9, 3, 1, 5, 88, 22, 99] # sort in decreasing order my_list = sorted(my_list, reverse=True) print(my_list) # sort in increasing order my_list = sorted(my_list, reverse=False) print(my_list) # another way to sort using built-in methods my_li... Add solution -
Javascript 2022-02-01 12:06:57
8.3.1. Common Array Methods // sort Examples (.sort)
//The general syntax for this method is: arrayName.sort() /*This method arranges the elements of an array into increasing order. For strings, this means alphabetical order. HOWEVER, the results are not always what we expect.*/ let letters = ['f', 'c',... Add solution -
Python 2022-01-31 14:11:48
In-place merge two sorted arrays
def merge(X, Y): m = len(X) n = len(Y) # Consider each element `X[i]` of list `X[]` and ignore the element if it is # already in the correct order; otherwise, swap it with the next smaller # element, which happens to be the first e... Add solution -
Python 2022-01-31 13:06:47
sort strings as numbers python
a = sorted(a, key=lambda x: float(x)) Add solution -
Javascript 2022-01-30 02:56:02
javascript how to sort variables by user input
<!DOCTYPE html> <html> <body> <p>Type x, y, zand click "Sort" to get them sorted</p> <button onclick="sort()">sort</button> <p id="answer"></p> <script&g... Add solution