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

anagram python

def isAnagram(A,B):
  if sorted(A) == sorted(B):
    print("Yes")
  else:
    print("No")
isAnagram("earth","heart") #Output: Yes

#Hope this helps:)
Comment

finding anagrams in python

is_anagram = lambda x1, x2: sorted(x1) == sorted(x2)

print(is_anagram('silent','listen')) # True
print(is_anagram('elivs', 'dead')) # False
Comment

PREVIOUS NEXT
Code Example
Python :: how to get cube root python 
Python :: python text to speech 
Python :: pyttsx python not working 
Python :: remove grid from 3d plots 
Python :: change the size of a button tkinter 
Python :: qt platform plugin could not be initialized stackoverflow 
Python :: h==gmail 
Python :: how to store a int value in django sessions 
Python :: scrapy link extractors in regular spiders 
Python :: tf.slice 
Python :: print g 
Python :: autoscrapper installation 
Python :: 52277-36880 
Python :: saree 
Python :: lllll 
Python :: print Hello in horse 
Python :: minio python remove an object 
Python :: first and last upper 
Python :: how to for loop length print in python 
Python :: run python script with admin rights 
Python :: download python 3.6 64 bit for windows 7 
Python :: pdf to excel python 
Python :: list of words from a string and filter them based on a secondary list 
Python :: Using rstrip() method to remove the newline character from a string 
Python :: Tableau prep encoding to a set of fields in a flow 
Python :: Classical Cryptography: Using Classical Ciphers with pycipher. 
Python :: python chunks iterator 
Python :: using rlike in pyspark for numeric 
Python :: handdle close window action in pyqt5 
Python :: how to use python-socker.io with fast api 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =