Ралица обнови решението на 19.03.2014 16:51 (преди над 10 години)
+LETTERS = list('абвгдежзийклмнопрстуфхцчшщъьюя')
+
+
+def is_pangram(sentence):
+ index = 0
+ missing_letter = False
+ while (index < len(LETTERS)) and not missing_letter:
+ if LETTERS[index] in list(sentence):
+ index += 1
+ else:
+ missing_letter = True
+ return not missing_letter
+
+
+def char_histogram(text):
+ histogram = {}
+ for thing in text:
+ if thing in histogram:
+ histogram[thing] += 1
+ else:
+ histogram[thing] = 1
+ return histogram
+
+
+def group_by_type(dictionary):
+ grouped = {}
+ for thing in dictionary:
+ if type(thing) in grouped:
+ grouped[type(thing)][thing] = dictionary[thing]
+ else:
+ grouped[type(thing)] = {thing: dictionary[thing]}
+ return grouped
+
+
+def sort_by(func, argument):
+ is_sorted = []
+ while argument:
+ index_min = 0
+ for index in range(1, len(argument)):
+ if func(argument[index], argument[index_min]) > 0:
+ index_min = index
+ is_sorted.append(argument.pop(index_min))
+ return is_sorted
+
+
+def sind_anagrams(first, second):
+ return set(first) == set(second)
+
+
+def anagrams(words):
+ are_anagrams = []
+ while words:
+ word = words.pop()
+ concrete_anagrams = [word]
+ for other_word in list(words):
+ if sind_anagrams(other_word, word):
+ concrete_anagrams.append(other_word)
+ words.remove(other_word)
+ are_anagrams.append(concrete_anagrams)
+ return are_anagrams