Calcolatore Calorie Bruciate
Stima le calorie bruciate durante l'esercizio in base al tipo di attività, durata e peso.
Domande Frequenti
Implementazione del Codice
def calories_burned(met: float, weight_kg: float, duration_hours: float) -> float:
"""
MET-based calorie burn formula.
Calories = MET * weight(kg) * duration(hours)
MET 1.0 = resting metabolic rate (kcal/kg/h).
"""
return met * weight_kg * duration_hours
# Common activities with approximate MET values
activities = [
("Walking 4 km/h", 2.8),
("Walking 6 km/h", 4.0),
("Cycling 15 km/h", 6.0),
("Jogging 8 km/h", 8.0),
("Running 12 km/h", 11.5),
("Swimming (moderate)", 6.0),
("Strength training", 5.0),
("Yoga", 2.5),
("High-intensity interval", 12.0),
("Sitting (rest)", 1.0),
]
weight_kg = 70.0
duration_min = 30
duration_h = duration_min / 60
print(f"Calorie burn for {weight_kg} kg person, {duration_min} minutes:")
print(f"{'Activity':<30} {'MET':>5} {'kcal':>6}")
print("-" * 45)
for name, met in activities:
kcal = calories_burned(met, weight_kg, duration_h)
print(f"{name:<30} {met:>5.1f} {kcal:>6.0f}")
# Weekly summary
weekly = [
("Running 8 km/h", 8.0, 30),
("Cycling 15 km/h", 6.0, 45),
("Yoga", 2.5, 60),
]
total = sum(calories_burned(m, weight_kg, d/60) for _, m, d in weekly)
print(f"\nWeekly total: {total:.0f} kcal")Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.