In [5]:
#lst = [5, 50, 56]
lst = [50, 8, 7, 29, 301, 3810, 9, 992, 1, 90]

#this will search for the whole list 1x for i_dwn
def list_sort(lst):
    change = True
    lst_inital = lst
    iterations = 0
    original = make_num(lst_inital)
    
    while change == True:
        i = 0
        j = i+1
        print('---before while---')
        print('lst_inital:',lst_inital)
        print('lst:',lst)
        print('')
        
        while j < len(lst):       
            n0 = (int(str(lst[i]) + str(lst[j]))) 
            n1 = (int(str(lst[j]) + str(lst[i])))

            print('---in while, before if---')
            print('lst_inital:',lst_inital)
            print('lst:',lst)
            print('')
 
            if n0 < n1:
                lst[i],lst[j] = lst[j],lst[i]
            i+=1
            j=i+1
            iterations += 1

            print('---in while, after if---')
            print('lst_inital:',lst_inital)
            print('lst:',lst)
            print('')
        
        n0 = make_num(lst)
        print(n0)
        print(original)
        
        if n0 < original:
            print(lst)
            print(lst_inital)
            print(True)
            change = True
        else:
            print(lst)
            print(lst_inital)
            print(False)
            change = False

        print(iterations)
        return lst

# function to print the list as a number
# this still needs to print off lists with multiple nubmers in them
def make_num(lst_sorted):
    s_total = ''
    for i in lst_sorted:
        s_total += str(i)
    return int(s_total)


# this calls the initial sort
x = list_sort(lst)
print(make_num(x))
print(make_num(lst))


---before while---
lst_inital: [50, 8, 7, 29, 301, 3810, 9, 992, 1, 90]
lst: [50, 8, 7, 29, 301, 3810, 9, 992, 1, 90]

---in while, before if---
lst_inital: [50, 8, 7, 29, 301, 3810, 9, 992, 1, 90]
lst: [50, 8, 7, 29, 301, 3810, 9, 992, 1, 90]

---in while, after if---
lst_inital: [8, 50, 7, 29, 301, 3810, 9, 992, 1, 90]
lst: [8, 50, 7, 29, 301, 3810, 9, 992, 1, 90]

---in while, before if---
lst_inital: [8, 50, 7, 29, 301, 3810, 9, 992, 1, 90]
lst: [8, 50, 7, 29, 301, 3810, 9, 992, 1, 90]

---in while, after if---
lst_inital: [8, 7, 50, 29, 301, 3810, 9, 992, 1, 90]
lst: [8, 7, 50, 29, 301, 3810, 9, 992, 1, 90]

---in while, before if---
lst_inital: [8, 7, 50, 29, 301, 3810, 9, 992, 1, 90]
lst: [8, 7, 50, 29, 301, 3810, 9, 992, 1, 90]

---in while, after if---
lst_inital: [8, 7, 50, 29, 301, 3810, 9, 992, 1, 90]
lst: [8, 7, 50, 29, 301, 3810, 9, 992, 1, 90]

---in while, before if---
lst_inital: [8, 7, 50, 29, 301, 3810, 9, 992, 1, 90]
lst: [8, 7, 50, 29, 301, 3810, 9, 992, 1, 90]

---in while, after if---
lst_inital: [8, 7, 50, 301, 29, 3810, 9, 992, 1, 90]
lst: [8, 7, 50, 301, 29, 3810, 9, 992, 1, 90]

---in while, before if---
lst_inital: [8, 7, 50, 301, 29, 3810, 9, 992, 1, 90]
lst: [8, 7, 50, 301, 29, 3810, 9, 992, 1, 90]

---in while, after if---
lst_inital: [8, 7, 50, 301, 3810, 29, 9, 992, 1, 90]
lst: [8, 7, 50, 301, 3810, 29, 9, 992, 1, 90]

---in while, before if---
lst_inital: [8, 7, 50, 301, 3810, 29, 9, 992, 1, 90]
lst: [8, 7, 50, 301, 3810, 29, 9, 992, 1, 90]

---in while, after if---
lst_inital: [8, 7, 50, 301, 3810, 9, 29, 992, 1, 90]
lst: [8, 7, 50, 301, 3810, 9, 29, 992, 1, 90]

---in while, before if---
lst_inital: [8, 7, 50, 301, 3810, 9, 29, 992, 1, 90]
lst: [8, 7, 50, 301, 3810, 9, 29, 992, 1, 90]

---in while, after if---
lst_inital: [8, 7, 50, 301, 3810, 9, 992, 29, 1, 90]
lst: [8, 7, 50, 301, 3810, 9, 992, 29, 1, 90]

---in while, before if---
lst_inital: [8, 7, 50, 301, 3810, 9, 992, 29, 1, 90]
lst: [8, 7, 50, 301, 3810, 9, 992, 29, 1, 90]

---in while, after if---
lst_inital: [8, 7, 50, 301, 3810, 9, 992, 29, 1, 90]
lst: [8, 7, 50, 301, 3810, 9, 992, 29, 1, 90]

---in while, before if---
lst_inital: [8, 7, 50, 301, 3810, 9, 992, 29, 1, 90]
lst: [8, 7, 50, 301, 3810, 9, 992, 29, 1, 90]

---in while, after if---
lst_inital: [8, 7, 50, 301, 3810, 9, 992, 29, 90, 1]
lst: [8, 7, 50, 301, 3810, 9, 992, 29, 90, 1]

87503013810999229901
50872930138109992190
[8, 7, 50, 301, 3810, 9, 992, 29, 90, 1]
[8, 7, 50, 301, 3810, 9, 992, 29, 90, 1]
False
9
87503013810999229901
87503013810999229901

In [8]:
l = [1,2,3,4]
l1 = l
l[0] = 3
print(l)
print(l1)


[3, 2, 3, 4]
[3, 2, 3, 4]

In [ ]: