Даяна обнови решението на 19.03.2014 16:56 (преди над 10 години)
+def is_pangram(sentence):
+ sentence = sentence.lower()
+ char_in_sentence = []
+ for char in sentence:
+ if char not in char_in_sentence and char.isalpha():
+ char_in_sentence.append(char)
+ if len(char_in_sentence) == 30:
+ return True
+ return False
+
+
+def char_histogram(sentence):
+ char_in_sentence = {}
+ for char in sentence:
+ if char not in char_in_sentence:
+ char_in_sentence[char] = 1
+ else:
+ char_in_sentence[char] += 1
+ return char_in_sentence
+
+
+import functools
+
+
+def sort_by(func, arguments):
+ result = sorted(arguments, key=functools.cmp_to_key(func))
+ return result
+
+
+def group_by_type(dictionary):
+ result = {}
+ for key in dictionary:
+ if not type(key) in result:
+ result[type(key)] = {key: dictionary[key]}
+ else:
+ result[type(key)].update({key: dictionary[key]})
+ return result
+
+
+def anagrams(words):
+ d = {}
+ result = []
+ for item in words:
+ if "".join(sorted(item)) not in d:
+ d["".join(sorted(item))] = [item]
+ else:
+ d["".join(sorted(item))].append(item)
+ for key in d:
+ result.append(d[key])
+ return result