Александър обнови решението на 19.03.2014 13:56 (преди над 10 години)
+import functools
+
+
+def is_pangram(sentence):
+ cyrillic_alphabet = "абвгдежзийклмнопрстуфхцчшщъьюя"
+
+ for letter in cyrillic_alphabet:
+ if letter not in sentence and letter.upper() not in sentence:
+ return False
+ return True
+
+
+def char_histogram(text):
+ return {symbol: text.count(symbol) for symbol in text}
+
+
+def sort_by(func, arguments):
+ return sorted(arguments, key=functools.cmp_to_key(func))
+
+
+def group_by_type(argument):
+ return {type(i): {j: argument[j] for j in argument if type(i) == type(j)}
+ for i in argument}
+
+
+def only_letters(word):
+ return "".join(letter.lower() for letter in word if letter.isalpha())
+
+
+def is_anagram(word, anagram):
+ return sorted(only_letters(anagram)) == sorted(only_letters(word))
+
+
+def anagrams(words):
+
+ sorted_anagram = []
+ remembering_anagrams = []
+
+ for word in words:
+ if sorted(only_letters(word)) not in remembering_anagrams:
+ remembering_anagrams.append(sorted(only_letters(word)))
+ sorted_anagram.append([anagram for anagram in words
+ if is_anagram(word, anagram)])
+
+ return sorted_anagram