Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def areSimilar(a, b):
- if a == b:
- return True
- a_sort = list(a)
- b_sort = list(b)
- a_sort.sort()
- b_sort.sort()
- if a_sort != b_sort:
- return False
- x = 0
- difference = 0
- while x < len(a):
- if a[x] != b[x]:
- difference = difference + 1
- x = x + 1
- if difference == 2:
- return True
- else:
- return False
Advertisement
Add Comment
Please, Sign In to add comment