Стоян обнови решението на 14.03.2014 00:44 (преди над 10 години)
+PARASITES = {'Э', 'э', 'Ы', 'ы'}
+def is_pangram(sentence):
+ bg_alpha = {chr(code) for code in range(ord('А'), ord('я') + 1)}
+ inp = {letter for letter in sentence.upper()}
+ return len(bg_alpha - PARASITES - inp) == 30
+
+def char_histogram(text):
+ return {symbol: text.count(symbol) for symbol in text}
+
+def group_by_type(dictionary):
+ keys = dictionary.keys()
+ same = lambda x, y: type(x) == type(y)
+ return {type(k1): {k2: dictionary[k2] for k2 in keys if same(k1, k2)} for k1 in keys}
+
+def anagrams(words):
+ anagram = lambda x, y: char_histogram(x) == char_histogram(y)
+ return list({tuple([y for y in words if anagram(x, y)]) for x in words})
+
+import functools
+def sort_by(func, arguments):
+ return sorted(arguments, key=functools.cmp_to_key(func))