Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def anagramCheck(str1, str2):
- list1 = list(str1)
- list2 = list(str2)
- list1.sort()
- list2.sort()
- position = 0
- matches = True
- while position < len(str1) and matches:
- if list1[position] == list2[position]:
- position = position + 1
- else:
- matches = False
- return matches
- print(anagramCheck('ababa', 'aboba'))
Advertisement
Add Comment
Please, Sign In to add comment