Anagram
Në shqip: Anagrami
ShpjegimiSQ
Dy fjalë janë anagrame nëse kanë saktësisht të njëjtat shkronja në rend tjetër — „sorra“ dhe „roras“. Kontrollohet duke i renditur shkronjat ose duke i numëruar me një fjalor.
EnglishEN
Two words are anagrams if they have exactly the same letters in a different order — “listen” and “silent”. You check by sorting the letters or counting them with a dictionary.
Si ta mendosh
Si dy fjalë të ndërtuara me të njëjtat copa Scrabble.
Lexoje në anglisht
Like two words built from the same Scrabble tiles.
Shembull kodipython
from collections import Counter
def jane_anagrame(a, b):
return Counter(a.lower()) == Counter(b.lower())
jane_anagrame("listen", "silent") # True