Ajout du tp de python et regex
This commit is contained in:
14
sisr2/sisr/35-python/exo.py
Normal file
14
sisr2/sisr/35-python/exo.py
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
chaine= str (input('saisir une chaine : '))
|
||||
tab = choisir.split(' ')
|
||||
cptmot={}
|
||||
|
||||
for mot in tab:
|
||||
if mot in cptmot:
|
||||
cptmot[mot]+=1
|
||||
else:
|
||||
cptmot[mot]=1
|
||||
|
||||
for mot in cptmot.keys():
|
||||
print("mot:",mot,":"cptmot[mot])
|
||||
Reference in New Issue
Block a user