Answered step by step
Verified Expert Solution
Link Copied!

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Engineering Mathematics

Authors: ERWIN KREYSZIG

9th Edition

0471488852, 978-0471488859

More Books

Students also viewed these Accounting questions

Question

What is the biggest challenge facing the organization?

Answered: 1 week ago

Question

explain how self-talk works,

Answered: 1 week ago

Question

Describe strategies for building self-confidence.

Answered: 1 week ago

Question

discuss how to improve attentional focus.

Answered: 1 week ago