Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

anagram program in python

def IsAnagram(string1,string2):
    lenth = len(string2)
    total = 0 
    for char in string1:
        if char in string2:
            total += 1
    if total == lenth:
        return True 
    return False
print(IsAnagram("amd","madd"))
Comment

how to write a code for anagram in python

def anagramCheck2(str1,str2):  
    # Convert string into lists  
    list1 = list(str1)  
    list2 = list(str2)  
    # Sort the list value  
    list1.sort()  
    list2.sort()  
  
    position = 0  
    matches = True  
  
    while position < len(str1) and matches:  
        if list1[position]==list2[position]:  
            position = position + 1  
        else:  
            matches = False  
  
    return matches  
Comment

PREVIOUS NEXT
Code Example
Python :: python index 2d array 
Python :: split by several characters python 
Python :: easy frequency analysis python 
Python :: how to concatenate dataframe in python 
Python :: pandas normalize columns 
Python :: how to convert text to speech using pthon 
Python :: django reverse function 
Python :: spacy tokineze stream 
Python :: python how to turn a word into a list 
Python :: udp server python 
Python :: factors for negative number python 
Python :: python get element from dictionary 
Python :: python regex search file 
Python :: extract name of file from path python 
Python :: numpy remove nan rows 
Python :: import yaml python3 
Python :: split pandas dataframe in two 
Python :: how to check for a substring in python 
Python :: python word starts with 
Python :: django update request.post 
Python :: __delattr__ python 
Python :: enumerate from 1 python 
Python :: python rps 
Python :: nice python turtle code 
Python :: concat string columns in pandas 
Python :: convert tensor to numpy array 
Python :: driver code in python 
Python :: add element in set python 
Python :: transform data frame in list 
Python :: spotify api python 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =