365 Days of code: Day 2

There are 10 kinds of people in this world. Those who know binary and those who don’t.

Anonymous

Calculating Total Daily Energy Expenditure (TDEE)

TDEE = BMR x Activity Level Multiplier

where:
BMR = (height in centimeters x 6.25) + (weight in kilograms x 9.99) – (age x 4.92) + 5 for males
and = (height in centimetres x 6.25) + (weight in kilograms x 9.99) – (age x 4.92) – 161 in case of females.

Activity level multiplier varies as below:
Sedentary (little to no exercise) = 1.1
Lightly Active (light exercise/sports 1-3 days/week) = 1.275
Moderately Active (moderate exercise/sports 3-5 days/week) = 1.35
Very Active (hard exercise/sports 6-7 days a week) = 1.525

Learning by doing

One of the best thing about building a project is we often come across a new problem that we haven’t encountered before. Then we search on Google for a solution and go through some documentation. We then zero in on a solution that elegantly solves the problem. In the process, we learn by doing. This is far more effective than reading a book cover to cover and trying to grasp concepts in isolation.

A project mimics real-world problems to which we have to apply just-in-time (JIT) learning to implement a solution. All good programmers are basically good JIT learners. Nobody knows everything. Get the basics down and the rest you can Google or ask on StackOverflow.

Code

Output

Leave Comment

Your email address will not be published. Required fields are marked *

Scroll Up