Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
def SelectionSort(numbers):
for p in range(len(numbers)-1): #setting up the loop to go as many times as the length of the list
start = p
for N in range(p,len(numbers)): #N stores the lowest value interating throught the list
if numbers[N] < numbers[start]: #N is used to store the lowest value to iterate through the list
start = N
temp = numbers[p] #a temporary variable to get the lowest variable
numbers[p] = numbers[start] #assigning the lowest number to the new start
numbers[start] = temp #assigning the start as the temp for the loop
print(numbers) #printing out each line of the sort
numbers = [36573,462829,6,567,436,353652,35251,35241,-10,354,0,4645] #the input numbers to be sorted
SelectionSort (numbers)