🛠️ToolsShed

Calculateur de poids idéal

Calculez votre poids corporel idéal en fonction de votre taille à l'aide de plusieurs formules.

Questions Fréquentes

Implémentation du Code

def ideal_weight(height_cm: float, sex: str) -> dict:
    """
    Calculate ideal body weight using Devine, Robinson, and Miller formulas.
    sex: 'male' or 'female'
    Returns weights in kg.
    """
    height_in = height_cm / 2.54
    inches_over_5ft = max(0, height_in - 60)  # inches above 5 feet

    if sex == "male":
        devine  = 50.0  + 2.3   * inches_over_5ft
        robinson = 52.0 + 1.9   * inches_over_5ft
        miller   = 56.2 + 1.41  * inches_over_5ft
    else:
        devine  = 45.5  + 2.3   * inches_over_5ft
        robinson = 49.0 + 1.7   * inches_over_5ft
        miller   = 53.1 + 1.36  * inches_over_5ft

    bmi_low  = 18.5 * (height_cm / 100) ** 2
    bmi_high = 24.9 * (height_cm / 100) ** 2

    return {
        "devine_kg":  round(devine, 1),
        "robinson_kg": round(robinson, 1),
        "miller_kg":  round(miller, 1),
        "bmi_range_kg": f"{bmi_low:.1f} - {bmi_high:.1f}",
    }

result = ideal_weight(170, "female")
print(f"Devine   : {result['devine_kg']} kg")
print(f"Robinson : {result['robinson_kg']} kg")
print(f"Miller   : {result['miller_kg']} kg")
print(f"BMI 18.5-24.9: {result['bmi_range_kg']} kg")

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.