πŸ› οΈToolsShed

Kalkulator Tipe Tubuh

Tentukan tipe tubuh Anda (Ektomorf, Mesomorf, Endomorf) berdasarkan pengukuran.

Klasifikasi tipe tubuh adalah perkiraan sederhana berdasarkan pengukuran tulang. Komposisi tubuh individu sangat bervariasi. Konsultasikan dengan profesional kebugaran untuk saran yang dipersonalisasi.

Pertanyaan yang Sering Diajukan

Implementasi Kode

def classify_body_type(wrist_cm, height_cm):
    """
    Classify somatotype using the wrist-to-height ratio.

    Thresholds (empirical):
        ratio < 0.1035  β†’ Ectomorph  (small frame)
        ratio > 0.1160  β†’ Endomorph  (large frame)
        otherwise       β†’ Mesomorph  (medium frame)

    Parameters:
        wrist_cm  - wrist circumference in centimetres
        height_cm - height in centimetres

    Returns one of: 'ectomorph', 'mesomorph', 'endomorph'
    """
    ratio = wrist_cm / height_cm
    if ratio < 0.1035:
        return "ectomorph"
    elif ratio > 0.1160:
        return "endomorph"
    return "mesomorph"


DESCRIPTIONS = {
    "ectomorph": "Slim frame, fast metabolism, difficulty gaining muscle or fat.",
    "mesomorph": "Athletic build, gains/loses weight relatively easily.",
    "endomorph": "Larger frame, gains weight easily, tends to retain fat.",
}


# Examples
test_cases = [
    (15.5, 180),  # small wrist, tall β†’ ectomorph
    (17.5, 175),  # medium           β†’ mesomorph
    (21.0, 170),  # large wrist      β†’ endomorph
]

for wrist, height in test_cases:
    body_type = classify_body_type(wrist, height)
    ratio     = wrist / height
    print(f"Wrist {wrist}cm / Height {height}cm = ratio {ratio:.4f} β†’ {body_type}")
    print(f"  {DESCRIPTIONS[body_type]}")

Comments & Feedback

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