Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def isAnagram(word , word2): #returns true if a word is an anagram of word2
- word = word.lower()
- word2 = word2.lower()
- list1 = list()
- list2 = list()
- for letter in word:
- list1.append(letter)
- for letter in word2:
- list2.append(letter)
- for letter in list1:
- try:
- list2.index(letter)
- except ValueError:
- return False
- return True
- word1 = "looped"
- word2 = "poodle"
- print word1 + " and " + word2
- print isAnagram(word1 , word2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement