Question: using python Two words are anagrams if they contains exactly the same letters but in a different order. Write a function are_anagrams (word, word2) which
Two words are anagrams if they contains exactly the same letters but in a different order. Write a function are_anagrams (word, word2) which returns True if the two parameters are anagrams. Big hints: 1. You've just been shown how to convert a word to a list of the letters in that word. 2. Lists of strings can be sorted into alphabetical order using the list sort() method (remember that you can use the built in help function to read the documentation for methods, such as help(list.sort)) 3. The equality operator '=='works on lists. 4. Two identical words are not anagrams. Hint: this does not require a for loop. For example: Test Result print(are_anagrams ("looped", "poodle")) True print(are_anagrams ("lopped", "poodle")) False print(are_anagrams ("poodle", "poodle")) False a
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
