You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
756 B

2 years ago
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