Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def sort(a, b):
- i = 0
- while i < len(a) - 1:
- if a[i] < b[i]:
- temp = b[i + 1]
- b[i + 1] = b[i]
- b[i] = temp
- elif a[i] > b[i]:
- temp = a[i + 1]
- a[i + 1] = a[i]
- a[i] = temp
- i += 1
- i = 0
- while i < len(a) - 1:
- if a[i] != b[i]:
- sort(a, b)
- break
- i += 1
- list1 = [1, 1, 7, 3, 2]
- list2 = [2, 1, 3, 7, 1]
- sort(list1, list2)
- print(list1)
- print(list2)
Add Comment
Please, Sign In to add comment