From 7176e495bdf027e52a8f2923c17c139a60f9ca81 Mon Sep 17 00:00:00 2001 From: Hbeyza Date: Sat, 11 Jan 2025 18:37:10 +0100 Subject: [PATCH 1/3] Add my Python project --- anagram_word.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 anagram_word.py diff --git a/anagram_word.py b/anagram_word.py new file mode 100644 index 000000000..e69de29bb From f57d2db2e4496c0067c8abe55fe25c21d6802a10 Mon Sep 17 00:00:00 2001 From: Hbeyza Date: Sat, 11 Jan 2025 23:49:55 +0100 Subject: [PATCH 2/3] Move is_anagram function to Solutions folder --- anagram_word.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/anagram_word.py b/anagram_word.py index e69de29bb..7be9947bf 100644 --- a/anagram_word.py +++ b/anagram_word.py @@ -0,0 +1,25 @@ +def is_anagram(words): + """ + Check if two words in a string are anagrams of each other. + + Args: + words (str): Two words separated by a comma (e.g., "listen,silent"). + + Returns: + bool: True if the words are anagrams, False otherwise. + + Examples: + >>> is_anagram("listen,silent") + True + >>> is_anagram("play,yellow") + False + >>> is_anagram("earth,heart") + True + >>> is_anagram("read,ride") + False + """ + # Split the words using the comma + word1, word2 = words.split(",") + + # Check if sorted characters of both words are the same + return sorted(word1.strip()) == sorted(word2.strip()) From aa937a3f041e2e4b359d1040ffd5d22b02670dde Mon Sep 17 00:00:00 2001 From: Hbeyza Date: Sun, 12 Jan 2025 11:34:42 +0100 Subject: [PATCH 3/3] Move anagram_word.py to solutions folder --- anagram_word.py => solutions/anagram_word.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename anagram_word.py => solutions/anagram_word.py (100%) diff --git a/anagram_word.py b/solutions/anagram_word.py similarity index 100% rename from anagram_word.py rename to solutions/anagram_word.py