Стефани обнови решението на 13.03.2014 00:31 (преди над 10 години)
+LETTERS = ['а', 'б', 'в', 'г', 'д', 'е', 'ж', 'з', 'й', 'и', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ь', 'ю', 'я']
+
+def is_pangram(sentence):
+ return [letter for letter in LETTERS if letter not in sentence] == []
+
+def frequency (symbol, sentence):
+ return sum([1 for letter in sentence if letter == symbol])
+
+def char_histogram(text):
+ dictionary = {}
+ for letter in text:
+ if letter not in dictionary.keys():
+ dictionary[letter] = frequency(letter, text)
+ return dictionary
+
+
+def find_all_of_type(types, dictionary):
+ result = {}
+ for key, value in dictionary.items():
+ if type(key) == types:
+ result[key] = value
+ return result
+
+
+def group_by_type(dictionary):
+ result_dictionary = {}
+ for key in dictionary.keys():
+ if type(key) not in dictionary.keys():
+ result_dictionary[type(key)] = find_all_of_type(type(key), dictionary)
+ return result_dictionary
+
+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]) < 0:
+ arguments[i], arguments[j] = arguments[j], arguments[i]
+ return arguments
+
+def take_all_of_kind(words, current_word):
+ all_of_kind = [current_word]
+ for word in words:
+ if check_two_words(current_word, word):
+ all_of_kind.append(word)
+ return all_of_kind
+
+
+def check_two_words(first_word, second_word):
+ return sorted(first_word) == sorted(second_word)
+
+def not_in(visited_words, current_word):
+ for word in visited_words:
+ if check_two_words(word, current_word):
+ return False
+ return True
+
+def anagrams(words):
+ visited_words = []
+ sorted_words = []
+ for word in words:
+ if not_in(visited_words, word):
+ sorted_words.append(take_all_of_kind(words, word))
+ return sorted_words
+
+
+
+
Спазвай PEP8.