Exercices Python
This commit is contained in:
15
sio2/sisr/python/ex3.py
Executable file
15
sio2/sisr/python/ex3.py
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/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 cle in cptmot.keys():
|
||||
print(cle, cptmot[cle])
|
||||
|
||||
Reference in New Issue
Block a user