Python V1
This commit is contained in:
14
Sio2/SISR/30-python/prog3.py
Executable file
14
Sio2/SISR/30-python/prog3.py
Executable 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])
|
||||
Reference in New Issue
Block a user