Advertisement
Spocoman

Calorie Calculator

Sep 23rd, 2023
1,029
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. from math import ceil
  2.  
  3. gender = input()
  4. weight = float(input())
  5. height = float(input())
  6. age = int(input())
  7. physical_activity = input()
  8.  
  9. basal_metabolic_rate = 0.0
  10. coefficient_activity = 0.0
  11.  
  12. if gender == 'm':
  13.     basal_metabolic_rate = 66 + weight * 13.7 + height * 500 - 6.8 * age
  14. else:
  15.     basal_metabolic_rate = 655 + weight * 9.6 + height * 180 - 4.7 * age
  16.  
  17. if physical_activity == "sedentary":
  18.     coefficient_activity = 1.2
  19. elif physical_activity == "lightly active":
  20.     coefficient_activity = 1.375
  21. elif physical_activity == "moderately active":
  22.     coefficient_activity = 1.55
  23. else:
  24.     coefficient_activity = 1.725
  25.  
  26. calories = ceil(basal_metabolic_rate * coefficient_activity)
  27.  
  28. print(f"To maintain your current weight you will need {calories} calories per day.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement