Python V1

This commit is contained in:
louis
2022-09-28 17:50:16 +02:00
parent 7a35ccf29e
commit 72aba346b9
5 changed files with 73 additions and 0 deletions

14
Sio2/SISR/30-python/prog3.py Executable file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/python3
phrase = str(input("Entrez votre phrase : "))
tabmots = phrase.split(" ")
cptmots = {}
for mot in tabmots:
if not mot in cptmots:
cptmots[mot] = 1
else:
cptmots[mot] = cptmots[mot] + 1
for mot in cptmots.keys():
print(mot, ":", cptmots[mot])