This commit is contained in:
Arthur BARRAUX
2022-09-07 12:03:33 +02:00
parent 1d50d4f538
commit 530355ca0c
+14 -29
View File
@@ -1,32 +1,17 @@
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: class Personnage:
def __init__(self, nom, age, notes=[]): def __init__(self, nom, cat):
self.nom = nom self.nom = nom
self.age = age self.categories = {
self.notes = notes "guerrier" : ["sword", "potion"],
"magicien" : ["stick", "potion"],
def _moyenne_(self): "thief" : ["dagger", "potion"],
try: "elfe" : ["bow", "potion"]
return sum(self.notes) / len(self.notes) }
except (ZeroDivisionError): self.pdv = 20
return False self.xp = 1
self.cat = cat
def au_dessus(self, m_classe): self.inv = self.categories[self.cat]
return self.moyenne() >= m_classe def jet_attaque(self):
pass