What do you want to save?
Add Code snippet
New code examples
-
Python 2021-11-21 12:33:28
how to sort a list in python
# sort() will change the original list into a sorted list vowels = ['e', 'a', 'u', 'o', 'i'] vowels.sort() # Output: # ['a', 'e', 'i', 'o', 'u'] # sorted() will sort the list and return it while keeping the original sortedVowels = sorted(vowels) # Output... Add solution -
Python 2021-11-09 14:13:13
def is_sorted(stuff): for i in stuff: if stuff[i+1] > stuff[i]: return True else: return False numbers = [1, 0, 5, 2, 8] print is_sorted(numbers)
test_list = [1, 4, 5, 8, 10] # printing original list print ("Original list : " + str(test_list)) # using sorted() to # check sorted list flag = 0 if(test_list == sorted(test_list)): flag = 1 # printing result if (flag... Add solution -
Python 2021-10-27 05:46:12
python bisect
1. bisect(list, num, beg, end) :- This function returns the position in the sorted list, where the number passed in argument can be placed so as to maintain the resultant list in sorted order. If the element is already present in the list, the right most ... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5