Пламен обнови решението на 17.03.2014 18:42 (преди над 10 години)
+ALPHABET = set(range(1072, 1104)) - {1099, 1101}
+'''
+1099 and 1101 are't in cirilic alphabet
+'''
+
+
+def is_pangram(expresion):
+ if len(expresion) < 30:
+ return False
+ lower_case_expresion = expresion.lower()
+ for a_char in ALPHABET:
+ if chr(a_char) not in lower_case_expresion:
+ return False
+ return True
+
+
+def char_histogram(expresion):
+ count_symbol = {}
+ for key in expresion:
+ if key in count_symbol:
+ count_symbol[key] += 1
+ else:
+ count_symbol[key] = 1
+ return count_symbol
+
+
+def sort_by(function, arguments):
+ stopper = True
+ while stopper:
+ stopper = False
+ for index in range(0, len(arguments)-1):
+ if function(arguments[index], arguments[index+1]) > 0:
+ arguments[index], arguments[index+1] = \
+ arguments[index+1], arguments[index]
+ stopper = True
+ return arguments
+
+
+def group_by_type(dictionary):
+ buffer_types = set()
+ for iterator in dictionary:
+ buffer_types.add(type(iterator))
+
+ current_values = {}
+ target = {}
+ for type_ in buffer_types:
+ for word in dictionary:
+ if type_ == type(word):
+ current_values[word] = dictionary[word]
+ target[type_] = dict(current_values)
+ current_values.clear()
+ return target
+
+
+def make_a_host(expresion):
+ result_host = set()
+ for char in expresion:
+ if char.isalpha():
+ result_host.add(char)
+ return result_host
+
+
+def anagrams(words):
+ iterated_word_host = set()
+ anagram = []
+ for index in range(len(words)):
+ temp_result = []
+ if index not in iterated_word_host:
+ current_word_host = make_a_host(words[index])
+ iterated_word_host.add(index)
+ temp_result.append(words[index])
+ else:
+ continue
+ for i in range(index+1, len(words)):
+ if i in iterated_word_host:
+ continue
+ temp_set = make_a_host(words[i])
+ if temp_set == current_word_host:
+ temp_result.append(words[i])
+ iterated_word_host.add(i)
+ anagram.append(temp_result)
+ return anagram