Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

python project anagram checker added #893

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Python/Projects/anagram/anagram - Shortcut.lnk
Binary file not shown.
25 changes: 25 additions & 0 deletions Python/Projects/anagram/anagram.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'''
This program checks if two strings are anagrams of each other.
An anagram is a word or phrase formed by rearranging the letters of a different word or phrase
'''

def check(str1,str2):
if(len(str1) != len(str2)):
print("The strings are not anagrams")
else:
str1 = str1.lower()
str2 = str2.lower()
str1 = sorted(str1)
str2 = sorted(str2)
if(str1 == str2):
print("The strings are anagrams")
else:
print("The strings are not anagrams")


def main():
str1 = input("Enter the first string: ")
str2 = input("Enter the second string: ")
check(str1,str2)

main()