🛠️ToolsShed

Vérificateur d'Anagrammes

Vérifiez si deux mots ou phrases sont des anagrammes l'un de l'autre.

Entrez les deux mots pour vérifier.

Questions Fréquentes

Implémentation du Code

from itertools import permutations

def get_anagrams(letters: str, word_list: list[str]) -> list[str]:
    """Find all words that are anagrams of the given letters."""
    sorted_letters = sorted(letters.lower())
    anagrams = []
    for word in word_list:
        if sorted(word.lower()) == sorted_letters:
            anagrams.append(word)
    return anagrams

# Example usage
words = ["listen", "silent", "enlist", "hello", "world", "inlets"]
result = get_anagrams("listen", words)
print(result)  # ['listen', 'silent', 'enlist', 'inlets']

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.