Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python anagram finder

def isAnagram(str1, str2):
    str1_list = list(str1)
    str1_list.sort()
    str2_list = list(str2)
    str2_list.sort()

    return (str1_list == str2_list)
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 :: django models integer field default value 
Python :: append in a for loop python 
Python :: python string to datetime object 
Python :: connect spark to postgres; connect spark to database 
Python :: df to csv 
Python :: print last exceuted query python 
Python :: flask error 
Python :: python append to 2d array 
Python :: how to change plot size in matplotlib 
Python :: random numbers python 
Python :: simple secatter plot 
Python :: python for loop with increment 
Python :: python remove key from dict 
Python :: readlines from file python 
Python :: python code to convert celsius to fahrenheit 
Python :: Action based permissions in Django Rest V3+ 
Python :: how to connect an ml model to a web application 
Python :: pandas for column in dataframe 
Python :: does jupyter notebook need internet 
Python :: ImportError: /home/user/.local/lib/python3.8/site-packages/pytorch3d/_C.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN2at5zerosEN3c108ArrayRefIlEENS0_13TensorOptionsE 
Python :: 2d dictionary in python 
Python :: python make comparison non case sensitive 
Python :: python iterate with index 
Python :: how to make a distance function in python 
Python :: how to retrieve dictionary values in python by index 
Python :: how to remove tkinter icon 
Python :: python add string and int 
Python :: python web parsing 
Python :: concatenate int to string python 
Python :: dimension of tensor 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =