Python - Comb Sorting Program : I am trying to write a program in python which should sort a list within a list. 

Examples - 

List before sorting: [[2, 1], [2, 2], [3, 3], [3, 1], [1, 1], [1, 2]]

List after sorting: [[1, 1], [1, 2], [2, 1], [2, 2], [3, 1], [3, 3]]

List before sorting: [[3, 3], [2, 2], [1, 2], [2, 1], [3, 1], [1, 1]]

List after sorting: [[1, 1], [2, 1], [1, 2], [2, 2], [3, 1], [3, 3]]

List before sorting: [[1, 1], [3, 3], [2, 1], [2, 2], [1, 2], [3, 1]]

List after sorting: [[1, 1], [1, 2], [2, 1], [2, 2], [3, 1], [3, 3]]


        import math
        
        def combsort(list1):
            gap = len(list1)
            shrink = 1.3
            sorted = False
        
            while sorted == False:
                gap = gap/shrink
                if gap > 1:
                    sorted = False
                else:
                    gap = 1
                    sorted = True
        
                i = 0
                while i + gap < gap:
                    distance1 = math.sqrt(list1[i[0]]**2 + list1[i[1]]**2)
                    distance2 = math.sqrt(list1[i+gap[0]]**2 + list1[i+gap[1]]**2)
                    if distance1 > distance2:
                        temporary = list1[i]
                        list1[i] = list1[i + gap]
                        temporary = list1[i + gap]
                        sorted = False
                    i = i + 1
    
    list1 = [[2, 1], [2, 2], [3, 3], [3, 1], [1, 1], [1, 2]] 
    combsort(list1)
    print(list1)

My code doesn't work and prints out the exact same list. Any help?