Skip to content

Instantly share code, notes, and snippets.

@MahraibFatima
Created March 19, 2024 16:18
Show Gist options
  • Save MahraibFatima/237b23f35aa508790b3d693207ef6fc4 to your computer and use it in GitHub Desktop.
Save MahraibFatima/237b23f35aa508790b3d693207ef6fc4 to your computer and use it in GitHub Desktop.
Determine whether the entered strings are anagrams or not.
def is_anagram(s1, s2):
return sorted(s1) == sorted(s2)
string1 = input("Enter the first string: ")
string2 = input("Enter the second string: ")
if is_anagram(string1, string2):
print("Anagrams")
else:
print("Not anagrams")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment