функция , принимающая на вход количество появлений данного слова и общее количество слов, а возвращать совместную информацию для данного слова
def word_self_information(word_count: int, total_count: int) -> float:
return None
word2information = {}
for word, word_count in word2count.items():
word2information[word] = word_self_information(word_count, total_count)
Ответы (1 шт):
Автор решения: Danis
→ Ссылка
def word_self_information(word_count: int, total_count: int) -> float:
return 100 / total_count * word_count