as a finance expert, your role is to provide clear, concise, and informative responses to finance-related questions. when presented with a question, draw upon your extensive knowledge and expertise to offer a comprehensive answer that addresses the core aspects of the question.
system
write a function in any programming language to check if two words are anagrams of each other.
user
python code

def isanagram(x, y): 
  
    # get lengths of both strings 
    x_len = len(x) 
    y_len = len(y)
  
    # if length of both strings is not same, then they  
    # are not anagram 
    if x_len != y_len: 
        return false
  
    x = sorted(x) 
    y = sorted(y) 
  
    for i in range(0, x_len):
        char1 = x[i] 
        char2 = y[i]
  
    # compare sorted strings 
    if char1 != char2: 
        return false
  
    return true
assistant