Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def unname(first,afterx):
- first = int(first)
- for y in afterx:
- if int(y) > first:
- return True
- if int(y) < first:
- return False
- return False
- def compare(a,b):
- if a == b:
- return False
- a = str(a)
- b = str(b)
- _lena = len(a)
- _lenb = len(b)
- x = min(_lena, _lenb)
- if int(a[:x]) > int(b[:x]):
- return True
- if int(a[:x]) < int(b[:x]):
- return False
- if _lena > _lenb:
- return not unname(a[0],a[x:])
- return not unname(b[0],b[x:])
- def custom_sort(arr):
- for i in range(len(arr) -1):
- for j in range(i, len(arr)):
- if not compare(arr[i],arr[j]):
- a = arr[i]
- arr[i] = arr[j]
- arr[j] = a
- return ''.join(str(e) for e in arr)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement