Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Two words are anagrams if they contains exactly the same letters but in a different order. Write a function are_anagrams(word1, word2) which returns True
Two words are anagrams if they contains exactly the same letters but in a different order. Write a function are_anagrams(word1, 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. 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 if are_anagrams("looped", "poodle"): Yes print ("Yes") else: print ("No") if are_anagrams ("lopped", "poodle"): No print ("Yes") else: print ("No") if are_anagrams ("poodle", "poodle"): No print ("Yes") else: print ("No")
Step by Step Solution
★★★★★
3.35 Rating (173 Votes )
There are 3 Steps involved in it
Step: 1
def areanagramss...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started