Did You Know?Keeping a healthy lifestyle consists of adapting our daily food intake with our level of physical activities. The calories we intake (by eating food) has to roughly match the calories we burn throughout the day.
For this challenge you are going to write a Python program that asks the user for their gender (Male of Female), their lifestyle (Sedentary, Moderately Active, Active) and their age.
The program will then tell them what their daily calorie intake should be.
The program should make use of the following table of data:
|Gender||Age (years)||Sedentary||Moderately Active||Active|
|Female||2 to 3||1000||1200||1400|
|4 to 8||1200||1400||1800|
|9 to 13||1600||1900||2200|
|14 to 18||1800||2100||2400|
|19 to 30||2000||2200||2400|
|31 to 50||1800||2000||2200|
|Male||2 to 3||1000||1200||1400|
|4 to 8||1400||1700||2000|
|9 to 13||1800||2200||2600|
|14 to 18||2200||2700||3200|
|19 to 30||2400||2700||3000|
|31 to 50||2200||2600||3000|
By Completing this learning challenge you will use:
- Nested If Statements,
- Comparison Operators such as ==, !=, <, <=, >, >=,
- Boolean Operators: AND or OR.
Complete this task progressively using the following 3 steps:
Start by asking the end-user for their gender.
If their gender is Male display your calorie intake is around 2400 calories for a man, or 2000 for a woman. If you need a reminder on how to use the input, if and print instructions in python check this page.
Add an input at the beginning to ask the user for their age (in years). Convert this input to an integer using the int() function. Use nested if to display the right daily calorie intake based on both the gender and the age. (Use the data from the first column, “sedentary” at this stage.)
Remember when using nested if statements to indent your code accordingly.
You can now use a third question to ask the user if they are “S” – Sedentary, “M” – Moderately Active, “A” Active.
Use a third level of indentation/nesting to complete this challenge using all the data from the given table.
Ask the user how many calories they have eaten so far (this day) and return the number of calories they can still have till the end of the day to match their recommended daily calorie intake.
Complete this fill in the gaps activity to check whether you can use the right computing terminology.