Ралица обнови решението на 15.03.2014 15:03 (преди над 10 години)
+from functools import cmp_to_key
+from collections import defaultdict
+CYRILLIC = set('абвгдежзийклмнопрстуфхцчшщьъюя')
+
+
+def is_pangram(sentence):
+ return CYRILLIC - set(sentence.lower()) == set()
+
+
+def char_histogram(text):
+ item_repetitions = {}
+ for symbol in text:
+ if symbol not in item_repetitions.keys():
+ item_repetitions[symbol] = 0
+ item_repetitions[symbol] += 1
+ return item_repetitions
+
+
+def sort_by(func, arguments):
+ return sorted(arguments, key=cmp_to_key(func))
+
+
+def group_by_type(dictionary):
+ v = defaultdict(dict)
+ for key, value in dictionary.items():
+ (v[(type(key))])[key] = value
+ return dict(v)
+
+
+def anagrams(words):
+ if words == []:
+ return words
+ left = [x for x in words if not set(x) == set(words[0])]
+ return [[x for x in words if set(x) == set(words[0])]] + anagrams(left)