siotp/sio2/sisr/20-python/cptmot.py
2021-10-06 09:32:17 +02:00

14 lines
266 B
Python
Executable File

#!/usr/bin/python3
phrase = input('Phrase : ')
tabmot = phrase.split(' ')
cptmot = {}
for mot in tabmot :
if mot in cptmot :
cptmot[mot] = cptmot[mot] + 1
else :
cptmot[mot] = 1
for key in cptmot.keys() :
print (key, " ", cptmot[key])