diff --git a/sio2/sisr/python/ex1.py b/sio2/sisr/python/ex1.py new file mode 100755 index 0000000..821a47f --- /dev/null +++ b/sio2/sisr/python/ex1.py @@ -0,0 +1,8 @@ +#!/usr/bin/python3 + +pi=3.141592 +r=int(input("Veuillez renseigner la valeur du rayon du cercle : ")) +p=2*pi*r + +print("Le périmètre vaut: ", p) + diff --git a/sio2/sisr/python/ex2.py b/sio2/sisr/python/ex2.py new file mode 100755 index 0000000..ef21996 --- /dev/null +++ b/sio2/sisr/python/ex2.py @@ -0,0 +1,27 @@ +#!/usr/bin/python3 +#Creation du tableau + +i=0 +tab=[] +total = 0 + +for i in range (5): + valeur = int(input("Entrez la valeur du tableau : ")) + tab.append(valeur) + print(tab) + +l = len(tab) + +maxi = tab[0] +mini = tab[0] +moyenne = 0 + +for i in range (0,l): + if mini > tab[i]: + mini = tab[i] + if maxi < tab[i]: + maxi = tab[i] + total = tab[i]+total + moyenne = total /(i+1) + +print("Le maximum : ", maxi,", le minimum : ", mini,", la moyenne : ", moyenne,", le total : ",total, ".") diff --git a/sio2/sisr/python/ex3.py b/sio2/sisr/python/ex3.py new file mode 100755 index 0000000..1105025 --- /dev/null +++ b/sio2/sisr/python/ex3.py @@ -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]) +