2022-09-28 17:24:40 +02:00

16 lines
296 B
Python
Executable File

#!/usr/bin/python3
phrase = str(input("Entrez une phrase à analyser : "));
tabmots = phrase.split(' ');
cptmots = {}
for mot in tabmots:
if mot not in cptmots:
cptmots[mot]=1
else:
cptmots[mot] = cptmots[mot] + 1
for mot in cptmots:
print(mot, ":", cptmots[mot])