Search
 
SCRIPT & CODE EXAMPLE
 

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)
Comment

PREVIOUS NEXT
Code Example
Python :: html in nested structure 
Python :: how to convert matlab code into python 
Python :: Example pandas.read_hdf5() 
Python :: Code Example of Comparing None with False type 
Python :: Flatten List in Python Using Shallow Flattening 
Python :: select majority pandas 
Python :: Math Module atan() Function in python 
Python :: how to decide that the input must be a integer less than 5 in python 
Python :: numpy find most distant elements in array 
Python :: copy director structure python 
Python :: python swap two numbers 
Python :: registration of the path django urls in the core app or main app 
Python :: affochage dun index du array list a deux dimension 
Python :: convert a float array to an integer 
Python :: fetch metric data from aws boto3 
Python :: Python NumPy broadcast_to() Function Syntax 
Python :: intervalle de temps python 
Python :: python request port 
Python :: codeforces problem 200B 
Python :: add a new field to a Hosted Feature Layer 
Python :: structure conditionnelle python 
Python :: Python how to use __truediv__ 
Python :: Open S3 object as string in Python 3 
Python :: NumPy left_shift Code When inputs and bit shift are an arrays 
Python :: center pyfiglet to terminal 
Python :: lpython list unino 
Python :: django hash password Argon 
Python :: combination in python without itertools 
Python :: pandas select random entry after groupby 
Python :: how to plot graph between f1 score and random forest parameters 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =