Ирина обнови решението на 17.03.2014 12:35 (преди над 10 години)
+ALPHABET = 'абвгдежзийклмнопрстуфхцчшщъьюя'
+
+def is_pangram(phrase):
+ return len([x for x in ALPHABET if x in phrase.lower()]) == len(ALPHABET)
+
+
+from functools import reduce
+
+def char_histogram(text):
+ return reduce(lambda d, x: dict(d, **{x: d.get(x, 0) + 1}), text, {})
+
+
+from functools import cmp_to_key
+
+def sort_by(func, list_will_be_sorted):
+ return sorted(list_will_be_sorted, key=cmp_to_key(func))
+
+
+from collections import defaultdict
+
+def group_by_type(dict_will_be_grouped):
+ group_dict = defaultdict(dict)
+ for x, v in dict_will_be_grouped.items():
+ group_dict[type(x)].update({x: v})
+ return group_dict
+
+def anagrams(word):
+ aw = [[y for y in word if set(y.lower()) == set(x.lower())] for x in word]
+ return list(map(list, set(map(tuple, aw))))