Question: PYTHON 3 Problem Complete the function isAnagram() to take in two strings and return True if word1 is an anagram of word2. A word is

PYTHON 3

PYTHON 3 Problem Complete the function isAnagram() to take in two strings

Problem

Complete the function isAnagram() to take in two strings and return True if word1 is an anagram of word2. A word is said to be an anagram of another if its letters can be re-arranged to create the other word.

Your solution must complete in O(n).

Hint: use a dictionary :)

Complete Code:

def isAnagram(word1, word2):

print(isAnagram("hello", "ohell")) # prints True print(isAnagram("a", "abcd")) # prints False

Instructions from your teacher Problem def isAnagram(word1, word2): 2 4 86 Complete the function isAnagram) to take in two strings and return True if wordl is an anagram of word2. A word is said to be an anagram of another if its letters can be re-arranged to create the other word print(?sAnagram("hello", print(?sAnagran("a", "ohell"))#prints "abcd")) # prints False True 7 Your solution must complete in O(n) Hint: use a dictionary:)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!