Ангел обнови решението на 19.03.2014 13:39 (преди над 10 години)
+from itertools import groupby
+
+
+def is_pangram(sentence):
+ alphabet = 'абвгдежзийклмнопрстуфхцчшщъьюя'
+ for i in range(0, len(sentence)):
+ if sentence[i].lower() in alphabet:
+ alphabet = alphabet.replace(sentence[i].lower(), '')
+ return alphabet == ''
+
+
+def char_histogram(text):
+ result = dict()
+ for i in range(0, len(text)):
+ if text[i] in result:
+ result[text[i]] += 1
+ else:
+ result.update({text[i]: 1})
+ return result
+
+
+def sort_by(func, arguments):
+ for i in range(0, len(arguments)):
+ for j in range(0, len(arguments)):
+ if func(arguments[i], arguments[j]) < 1:
+ temp_argument = arguments[i]
+ arguments[i] = arguments[j]
+ arguments[j] = temp_argument
+ return arguments
+
+
+def group_by_type(dictionary):
+ types = []
+ result = dict()
+ for key in dictionary:
+ if type(key) not in types:
+ types.append(type(key))
+ for i in range(0, len(types)):
+ temp = dict()
+ for j in dictionary:
+ if types[i] == type(j) and types[i] not in result:
+ temp.update({j: dictionary.get(j)})
+ result.update({types[i]: temp})
+ return result
+
+
+def anagrams(words):
+ return ([list(result) for key, result in
+ groupby(sorted(words, key=sorted), sorted)])