Anagram Program in Python
In this tutorial, you will learn the writing program in to check string is anagrams or not in Python.
Read This : What is Anagram? Write an anagram program in C.
How this Python program will behave?
This Python Program will take two String from user as an input. And after the comparison of two input string, program will return output.
If the string is anagram then Program will return “Given Strings are anagram”.
And if Strings are not anagram then it will return “Strings are not anagram”.
Anagrams program in Python
def anagramCheck(str1, str2): if (sorted(str1) == sorted(str2)) : return True else : return False str1 = input("Please enter String 1 : ") str2 = input("Please enter String 2 : ") if anagramCheck(str1,str2): print("Anagram") else: print("Not an anagram")
Also prepare these Python Programs:
Latest Uploads on Website
- AVL Tree with explanation
- Radix sort algorithm explanation with example
- Quick Sort Algorithm with explanation
- Bubble sorting algorithm with Bubble sort program in C
- Insertion sort algorithm and program in C
- Selection Sort Algorithm and Program in C
- Linear probing technique explanation with example
- Collision in Hashing and Collision resolution technique
- Hashing in data structure with its types
- Binary search tree operations with Program
- Binary search tree in data structure
- Binary search algorithm in data structure with explanation
- linear search in data structure with Algo and Program