EMSP Année Scolaire 2025- 2026
Prof : M .DEA Examen : Python
Classe : DSER / Licence 2 Durée : 4H
Exercices
Exercice 01
1- Traduire l’algorithme en Pyhon.
ALGORITHME Calcul
Variables
Resultat , i, Nombre : Entiers
Reponse : Caractère
DEBUT
Répéter
Afficher ("-----Bienvenue dans notre application -----")
Afficher ("Entrez un nombre")
Saisir(Nombre)
Pour i 1 à 10 FAIRE
Resultat i * Nombre
Afficher ( i , "*" , Nombre , "=" , Resultat)
FinPour
Afficher ("----------------------------------------")
Afficher ("Voulez-vous recommencer ? (O/N)")
Saisir(Reponse)
Jusqu'à (Reponse ≠ 'O' ET Reponse ≠ 'o')
FIN
Exercice 02
Traduire l’algorithme en Pyhon.
ALGORITHME IndiceSante
Variables
Poids, Taille, Pi, IMC : Réels
Sexe : Caractère
Interpretation : Chaine de caractères
DEBUT
Afficher ("Quel est votre poids en kg ?")
Saisir(Poids)
Page 1 sur 4
Afficher ("Quelle est votre taille en cm ?")
Saisir(Taille)
Afficher ("Entez votre sexe -- M ou F ")
Saisir(Sexe)
SI (Sexe='M') Alors
Pi (taille – 100) – (taille – 150) / 4
SINON
SI (Sexe='F') Alors
Pi (taille – 100) – (taille – 120) /4
FinSi
FinSi
Afficher ("Votre poids idéal est : ", Pi)
IMC Poids / ( (Taille/100) * (Taille/100) )
Afficher ("Votre indice de masse corporelle est : ", IMC )
SI ( IMC ≤ 18,5 ) Alors
Interpretation "Maigreur"
SINON
SI ( IMC > 18,5 ET IMC ≤ 27 ) Alors
Interpretation "Normal"
SINON
SI ( IMC > 27 ET IMC < 32 ) Alors
Interpretation "Obèse"
SINON
SI (IMC ≥ 32 ) Alors
Interpretation "Obésité morbide"
FinSi
FinSi
FinSi
FinSi
Afficher ("L’interprétation de votre IMC donne : ", Interpretation)
FIN
Page 2 sur 4
Exercice 03
Traduire l’algorithme en Pyhon.
ALGORITHME Equation
Variables
a, b, c, Delta, x1, x2 : Réels
DEBUT
Afficher ("Entrez le coefficient a : ")
Saisir(a)
Afficher ("Entrez le coefficient b : ")
Saisir(b)
Afficher ("Entrez le coefficient c : ")
Saisir(c)
SI (a = 0) Alors
Afficher ("Ce n'est pas une équation du second degré")
SINON
Delta ← (b * b) - (4 * a * c)
Afficher ("La valeur du discriminant est : ", Delta)
SI (Delta < 0) Alors
Afficher ("Pas de solution réelle")
SINON
SI (Delta = 0) Alors
x1 ← -b / (2 * a)
Afficher ("Solution unique : ", x1)
SINON
x1 ← (-b – racine(Delta) ) / (2 * a)
x2 ← (-b + racine(Delta) ) / (2 * a)
Afficher ("Deux solutions : x1 = ", x1, "x2 = ", x2)
FinSi
FinSi
FinSi
FIN
Page 3 sur 4
Exercice 03 (7 points)
On considère le programme Python suivant :
etudiants = {
"etudiant1": {"matricule": "A234", "nom": "Assi Jacques", "moyenne": 14.5},
"etudiant2": {"matricule": "B567", "nom": "Kouassi Marie", "moyenne": 12.8},
"etudiant3": {"matricule": "D123", "nom ": "Konan Aline", "moyenne": 13.7},
….
}
#Définition de la fonction MENU
def menu():
#Affichage du menu à l'utilisateur
print('======= Menu =======')
print('1 : Recherche par Matricule)
print('2 : Recherche par Nom)
print('3 : Moyenne classe')
print('4 : Quitter')
#Choix de l'option
choix = int(input("Faites un choix "))
if choix==1:
recherche_matricule()
elif choix==2 :
recherche_nom()
elif choix==3 :
moyenne_classe()
elif choix==4 :
print("Sortie du programme...")
else :
print("Choix incorrect")
menu()
print("***** FIN DU PROGRAMME *******")
Travail à faire :
À partir du dictionnaire « etudiants », contenant plus d’une centaine d’étudiants :
Écrire la fonction moyenne_classe() qui permet de calculer la moyenne de la classe.
Page 4 sur 4