Arthur BARRAUX
2 years ago
commit
1d50d4f538
1 changed files with 32 additions and 0 deletions
@ -0,0 +1,32 @@ |
|||||
|
class Personne: |
||||
|
def __init__(self, poids, taille, age): |
||||
|
self.poids = poids |
||||
|
self.age = age |
||||
|
self.taille = taille |
||||
|
|
||||
|
def imc(self): |
||||
|
return self.poids / (self.taille / 100) ** 2 |
||||
|
|
||||
|
def interpretation(self): |
||||
|
imc = self.imc() |
||||
|
if imc <= 18.5: |
||||
|
print("Insuffisance pondérale") |
||||
|
elif imc >= 30: |
||||
|
print("obésité") |
||||
|
|
||||
|
|
||||
|
class Eleve: |
||||
|
def __init__(self, nom, age, notes=[]): |
||||
|
self.nom = nom |
||||
|
self.age = age |
||||
|
self.notes = notes |
||||
|
|
||||
|
def _moyenne_(self): |
||||
|
try: |
||||
|
return sum(self.notes) / len(self.notes) |
||||
|
except (ZeroDivisionError): |
||||
|
return False |
||||
|
|
||||
|
def au_dessus(self, m_classe): |
||||
|
return self.moyenne() >= m_classe |
||||
|
|
Loading…
Reference in new issue