Решение на Пет функции от Моника Димитрова

Обратно към всички решения

Към профила на Моника Димитрова

Резултати

  • 8 точки от тестове
  • 0 бонус точки
  • 8 точки общо
  • 12 успешни тест(а)
  • 4 неуспешни тест(а)

Код

import string
import functools
def is_pangram(sentence):
alphabet = set('абвгдежзийклмнопрстуфхцчшщъьюя')
return set(sentence.lower()) >= alphabet
def char_histogram(text):
histogram = dict()
for symbol in text:
histogram[symbol] = text.count(symbol)
return histogram
def sort_by(func, arguments):
return sorted(arguments, key=functools.cmp_to_key(func))
def group_by_type(dictionary):
grouped = dict()
for (key, value) in zip(dictionary.keys(), dictionary.values()):
if type(key) in grouped:
grouped[type(key)][key] = value
else:
grouped[type(key)] = {key: value}
return grouped
def is_anagram(word, other_word):
return sorted(word) == sorted(other_word)
def anagrams(words):
return []

Лог от изпълнението

▸ Покажи лога

История (1 версия и 0 коментара)

Моника обнови решението на 19.03.2014 16:21 (преди около 11 години)

▸ Покажи разликите
+import string
+import functools
+
+def is_pangram(sentence):
+ alphabet = set('абвгдежзийклмнопрстуфхцчшщъьюя')
+ return set(sentence.lower()) >= alphabet
+
+def char_histogram(text):
+ histogram = dict()
+ for symbol in text:
+ histogram[symbol] = text.count(symbol)
+ return histogram
+
+def sort_by(func, arguments):
+ return sorted(arguments, key=functools.cmp_to_key(func))
+
+def group_by_type(dictionary):
+ grouped = dict()
+ for (key, value) in zip(dictionary.keys(), dictionary.values()):
+ if type(key) in grouped:
+ grouped[type(key)][key] = value
+ else:
+ grouped[type(key)] = {key: value}
+ return grouped
+
+def is_anagram(word, other_word):
+ return sorted(word) == sorted(other_word)
+
+def anagrams(words):
+ return []