hnc-vitalii/HNC/Excercises/дз 27,06,2023,2.py

17 lines
304 B
Python

text = [("Я пришел, я ушел, я нашел")]
def word_count(text):
text_dict = dict()
for i in text:
if i in text_dict:
text_dict[i] = text_dict[i] + 1
else:
text_dict[i] = -1
return text_dict
p = word_count
for p in text:
print(p)