Skip to content

Commit 1fe61af

Browse files
committed
Added Anagram Checker script
1 parent 6c55b1c commit 1fe61af

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

Anagram Checker/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<div align="center">
2+
3+
# Anagram Checker
4+
5+
</div>
6+
7+
### Description:
8+
This Python script checks if two words are anagrams of each other.
9+
10+
### How to Use:
11+
1. Run the script in a Python environment.
12+
2. Enter the first word when prompted.
13+
3. Enter the second word when prompted.
14+
4. The script will determine whether the two words are anagrams of each other and display the result.

Anagram Checker/anagram.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
def is_anagram(word1, word2):
2+
return sorted(word1.lower()) == sorted(word2.lower())
3+
4+
5+
def main():
6+
word1 = input("Enter the first word: ")
7+
word2 = input("Enter the second word: ")
8+
if is_anagram(word1, word2):
9+
print("Yes, the words are anagrams of each other!")
10+
else:
11+
print("No, the words are not anagrams.")
12+
13+
14+
if __name__ == "__main__":
15+
main()

0 commit comments

Comments
 (0)