Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python sorting array without inbuilt sort

data_list = [-5, -23, 5, 0, 23, -6, 23, 67]
new_list = []

while data_list:
    minimum = data_list[0]  # arbitrary number in list 
    for x in data_list: 
        if x < minimum:
            minimum = x
    new_list.append(minimum)
    data_list.remove(minimum)    

print new_list
Comment

sorting numbers in python without sort function

number=[1,5,6,9,0]
for i in range(len(number)):
  for j in range(i+1,len(number)):
    if number[i]<number[j]:
      number[i],number[j]=number[j],number[i]
print(number)
Comment

PREVIOUS NEXT
Code Example
Python :: plot bounds python 
Python :: store all files name in a folder python 
Python :: cosine interpolation 
Python :: string to float python pandas 
Python :: hot reloading flask 
Python :: find nan value in dataframe python 
Python :: discord embed colors python 
Python :: open python choose encoding 
Python :: make coordinate cyclic in python 
Python :: python multi line print 
Python :: python read text file look for string 
Python :: not scientific notation python 
Python :: Entry border color in tkinter 
Python :: clear all python cache 
Python :: python find location of module 
Python :: python datetime to timestamp 
Python :: df drop column 
Python :: list of strings to numbers python 
Python :: enumerate in python 
Python :: linkedin dynamic scrolling using selenium python 
Python :: exit all threads from within a thread python 
Python :: python how to change size of a window 
Python :: python print int in string with zero padding 
Python :: how to check the type of a variable in python 
Python :: python number to letter 
Python :: pandas get date from datetime 
Python :: get classification report sklearn 
Python :: convert mb to gb python 
Python :: display pythonpath linux 
Python :: find index of pandas column 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =