nouveau fichier : boucle.py
nouveau fichier : comptage_mot.py
This commit is contained in:
parent
f137b82fca
commit
b26199fa82
25
sio2/SISR/07-python/boucle.py
Normal file
25
sio2/SISR/07-python/boucle.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
tab=[]
|
||||||
|
for i in range(5):
|
||||||
|
chiffre=int(input("Veuillez saisir votre chiffre No : "))
|
||||||
|
tab.append(chiffre)
|
||||||
|
mini=tab[0]
|
||||||
|
maxi = tab[0]
|
||||||
|
cumul = 0
|
||||||
|
for val in tab:
|
||||||
|
if val < mini:
|
||||||
|
mini=val
|
||||||
|
print("Le plus petit element du tableau est : " , mini)
|
||||||
|
if val > maxi:
|
||||||
|
maxi=val
|
||||||
|
print("Le plus grand element du tableau est : " , maxi)
|
||||||
|
cumul += val
|
||||||
|
|
||||||
|
moy = cumul / len(tab)
|
||||||
|
print("La moyenne des valeurs du tableau est de : " , moy)
|
||||||
|
|
||||||
|
#affichage du tableau
|
||||||
|
print ("Voici tous les elements du tableau : ")
|
||||||
|
for element in tab:
|
||||||
|
print(element)
|
7
sio2/SISR/07-python/comptage_mot.py
Normal file
7
sio2/SISR/07-python/comptage_mot.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
phrase = input("Saisissez une phrase :" )
|
||||||
|
tab_mot = phrase.split(' ')
|
||||||
|
|
||||||
|
for mot in tab_mot:
|
||||||
|
print(mot)
|
Loading…
x
Reference in New Issue
Block a user