Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: Create a function to check if a given string is an anagram of another string.
Answer:

def is_anagram(str1, str2):

  return sorted(str1) == sorted(str2)

Example:

is_anagram(\'listen\', \'silent\')  # Output: True
Is it helpful? Yes No

Most helpful rated by users:

©2025 WithoutBook