Весела обнови решението на 19.03.2014 13:37 (преди над 10 години)
+from functools import reduce
+import string
+
+
+def is_pangram(sentence):
+ cyrillic_alphabet = "абвгдежзийклмнопрстуфхцчшщъьюя"
+ array_sentence = list(set(sentence.lower()))
+ return cyrillic_alphabet in "".join(sorted(array_sentence))
+
+
+def char_histogram(text):
+ return {x: len([a for a in text if a == x]) for x in text}
+
+
+def sort_by(func, arguments):
+ sorted_list = []
+ for i in range(0, len(arguments)):
+ minimal = reduce(lambda x, y: x if func(x, y) < 0 else y, arguments)
+ sorted_list.append(minimal)
+ arguments.remove(minimal)
+ return sorted_list
+
+
+def group_by_type(dictionary):
+ return {type(i): {d: dictionary[d] for d in dictionary
+ if type(d) == type(i)} for i in dictionary}
+
+
+def fix_word(word):
+ letters = "абвгдежзийклмнопрстуфхцчшщъьюя" + string.ascii_lowercase
+ return "".join(sorted([i for i in word.lower() if i in letters]))
+
+
+def anagrams(words):
+ fixed_words = [fix_word(x) for x in words]
+ return [[x for x in words if i == fix_word(x)] for i in set(fixed_words)]