Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python Anagram Using Counter() function

# Python3 program for the above approach
from collections import Counter
 
# function to check if two strings are
# anagram or not
def check(s1, s2):
   
    # implementing counter function
    if(Counter(s1) == Counter(s2)):
        print("The strings are anagrams.")
    else:
        print("The strings aren't anagrams.")
 
 
# driver code
s1 = "triangle"
s2 = "integral"
check(s1, s2)
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Python #Anagram #Using #function
ADD COMMENT
Topic
Name
3+5 =