Веселин обнови решението на 13.03.2014 02:17 (преди над 10 години)
+import itertools
+import functools
+
+
+def is_pangram(sentence):
+ alphabet = set('абвгдежзийклмнопрстуфхцчшщъьюя')
+ letters = {letter for letter in sentence.lower() if letter in alphabet}
+ return letters == alphabet
+
+
+def char_histogram(text):
+ return {key: text.count(key) for key in text}
+
+
+def sort_by(func, arguments):
+ return sorted(arguments, key=functools.cmp_to_key(func))
+
+
+def group_by_type(dictionary):
+ keys = list(dictionary.keys())
+ types = [key for key, _ in itertools.groupby(keys, type)]
+ return {key_type: {key: dictionary[key] for key in keys
+ if type(key) == key_type} for key_type in types}
+
+
+def anagrams(words):
+ return [list(value) for _, value
+ in itertools.groupby(words, char_histogram)]