1 answer

Write by python code and screenshoot the python code for me. thanks The Problem: You are...

Question:

write by python code and screenshoot the python code for me. thanks

The Problem:

You are to design a Calorie Intake Assistant tailored to the user’s personal characteristics.

The assistant will initially ask the user for his/her gender, name, age in years, height in cm and weight in kg. Based on these, the assistant will calculate the recommended daily calorie intake (RDCI) using the Mifflin – St Jeor formula[1], which is also shown to the user:

Mifflin – St Jeor formula:

Men 10 x weight (kg) + 6.25 x height (cm) – 5 x age (y) + 5

Women 10 x weight (kg) + 6.25 x height (cm) – 5 x age (y) – 161.

For each day of the week, the user must say how healthy their meals were: (very unhealthy, unhealthy, healthy, very healthy). Each meal has a corresponding calorie intake calculated based on the RDCI; the daily calorie intake is shown to the user.

Meal type

Calorie count

1

Very unhealthy

150% of RDCI

2

Unhealthy

120% of RDCI

3

Healthy

RDCI

4

Very healthy

80% of RDCI

In addition, daily the user can be tempted to eat things that were not planned for, such as having an ice-cream on a hot day. The daily temptation is generated randomly as 1 or 0. If the temptation exists (1 has been generated), a food item is added, chosen randomly from the following list (in brackets is shown the calorie equivalent of the item):

Temptation

Calorie count

chocolate

250

chips

550

ice-cream

207

fast-food  

350

fizzy drink

180

party cake

257

popcorn

375

For each day of the week the assistant calculates the daily calorie intake based on user ranking. Cal sums everything up and makes a daily average calorie intake (or ADCI), shown to the user. Based on this, Cal gives feedback and recommendations using the guide below. The program then exists.

ADCI / RDCI

Recommendations:

Lower than 90%

Username, your daily calorie intake is lower than the recommended with x%. This way you will lose weight, just make sure your meals contain all nutritional value needed. It’s recommended that you do not fall under the healthy weight and that you keep a balanced lifestyle.

Between 90% and 110%

Username, your daily calorie intake is close to the recommended one! You have a balanced healthy lifestyle, well done!

Higher than 110%

Username, your daily calorie intake is higher than the recommended with x%. This way you will gain weight, and in time health concerns may arise. It’s recommended that you either lower your calorie intake, either exercise more!

Example of How the Assistant Runs:

A: Welcome to the Calorie Intake Assistant, my name is Cal. What is your name?

U: Jane

A: Great Jane, let’s start! What is your gender? Enter M for male or F for female.

U: xxx

A: I’m sorry, I cannot understand. What is your gender? Enter M for male or F for female.

U: f

A: What is your age in years?

U: abd

A: I’m sorry, I cannot understand. What is your age in years?

U: 0

A: I’m sorry, I cannot understand. What is your age in years?

U: 25

A: What is your current weight in kg?

U: 59

A: What is your height in cm?

U: 150

A: Thank you for the information Jane!

A: Considering the details given, your daily recommended intake is of 1241.5 calories per day.

A: Let’s see how healthy your meals were last week.

A: Day 1: were your meals very unhealthy (1), unhealthy (2), healthy (3), or very healthy (4)? Enter the corresponding number.

U: 2

A: Day 2: were your meals very unhealthy (1), unhealthy (2), healthy (3), or very healthy (4)? Enter the corresponding number.

U: 5

A: I’m sorry, I cannot understand. Day 2: were your meals very unhealthy (1), unhealthy (2), healthy (3), or very healthy (4)? Enter the corresponding number.

U: 1

A: Day 3: were your meals very unhealthy (1), unhealthy (2), healthy (3), or very healthy (4)? Enter the corresponding number.

U: 2

A: Day 4: were your meals very unhealthy (1), unhealthy (2), healthy (3), or very healthy (4)? Enter the corresponding number.

U: 3

A: Day 5: were your meals very unhealthy (1), unhealthy (2), healthy (3), or very healthy (4)? Enter the corresponding number.

U: 3

A: Day 6: were your meals very unhealthy (1), unhealthy (2), healthy (3), or very healthy (4)? Enter the corresponding number.

U: 3

A: Day 7: were your meals very unhealthy (1), unhealthy (2), healthy (3), or very healthy (4)? Enter the corresponding number.

U: 4

A: Jane, here are your results:

A: 1489.8 calories intake in day 1

A: 1862.2 calories intake in day 2. Also, it looks like this day you’ve been tempted with popcorn and 375 calories have been added!

A: 1489.8 calories intake in day 3

A: 1241.5 calories intake in day 4

A: 1241.5 calories intake in day 5. Also, it looks like this day you’ve been tempted with chocolate and 250 calories have been added!

A: 1241.5 calories intake in day 6. Also, it looks like this day you’ve been tempted with party cake and 257 calories have been added!

A: 993.2 calories intake in day 7

A: During the last 7 days you had an intake of 10441.5 calories, meaning a daily average of 1491.64 calories.

A: Jane, your daily calorie intake is higher than the recommended with 20%. This way you will gain weight, and in time health concerns may arise. It’s recommended that you either lower your calorie intake, either exercise more!

A: Goodbye and good luck!


Answers

type your code according to image:
sample output:

python code

user_name=input('Welcome to the Calorie Intake Assistant, my name is Cal. What is your name?')
Gender=input('Great Jane, let’s start! What is your gender? Enter M for male or F for female.')
while Gender not in ['F','M','f','m']:
Gender=input('I’m sorry, I cannot understand. What is your gender? Enter M for male or F for female.')
while True:
try:
Age=int(input('What is your age in years?'))
except ValueError:
print('I’m sorry, I cannot understand. What is your age in years?')
continue
else:
if Age<=0:
print('I’m sorry, I cannot understand. What is your age in years?')
continue
break
while True:
try:
Weight=int(input('What is your Current weight in Kg?'))
except ValueError:
print('I’m sorry, I cannot understand.

What is your weight in Kg?')
continue
else:
break
while True:
try:
Height=int(input('What is your Height in cm?'))
except ValueError:
print('I’m sorry, I cannot understand. What is your height in cm?')
continue
else:
break
if 'm'==Gender.lower():
daily_recommended_intake=10*Weight+6.25*Height-5*Age+5
else:
daily_recommended_intake=10*Weight+6.25*Height-5*Age-161
print('Thank you for the information Jane!')
print('Considering the details given, your daily recommended intake is of {} calories per day.'.format(daily_recommended_intake))
print('Let’s see how healthy your meals were last week.')
mealtype={'1':1.5,'2':1.2,'3':1,'4':.8}
calory_intake_week=[]
count=1
import random
temptation_food={'chocolate':250,'chips':550,'ice-cream':207,'fast-food':350 ,'fizzy drink':180,'party cake':257,'popcorn':375}
temptation_food_calories=list(temptation_food.keys())
temptation=[]
for j in range(7):
temptation.append(random.randint(0, 1))
temptedfood=[]
count=1
while count<8:
while True:
print('Day {}: were your meals very unhealthy (1) unhealthy (2) healthy (3) very healthy (4) '.format(count))
x=input('Enter the corresponding number.: ')
if x in ['1','2','3','4']:
break
else:
print('I\'m sorry, I cannot understand.')
continue
temp=random.choice(list(temptation_food.keys()))
temptedfood.append(temp)
daily_intake=daily_recommended_intake*mealtype[x]+temptation[count-1]*temptation_food[temp]
calory_intake_week.append(daily_intake)
count+=1
print('Jane, here are your results:')
for i in range(len(calory_intake_week)):
print('{} calories intake in day {}, '.format(calory_intake_week[i],i+1),end='')
if temptation[i]==1:
print('Also, it looks like this day you’ve been tempted with {} and calories have been added!'.format(temptedfood[i]))
print()
print('During the last 7 days you had an intake of {} calories, meaning a daily average of {:.2f} calories.'.format(sum(calory_intake_week),sum(calory_intake_week)/len(calory_intake_week)))
average=sum(calory_intake_week)/len(calory_intake_week)
percentage=(average*100)/daily_recommended_intake
if percentage>110:
print('Jane, your daily calorie intake is higher than the recommended with {:.2f}%. This way you will gain weight, and in time health concerns may arise. It’s recommended that you either lower your calorie intake, either exercise more!'.format(percentage-100))
if percentage<=110 and percentage>=90:
print('Username, your daily calorie intake is close to the recommended one! You have a balanced healthy lifestyle, well done!')
if percentage<90:
print('Username, your daily calorie intake is lower than the recommended with {:.2f}%. This way you will lose weight, just make sure your meals contain all nutritional value needed.

It’s recommended that you do not fall under the healthy weight and that you keep a balanced lifestyle.'.format(100-percentage))
print('Goodbye and good luck!')

.

Similar Solved Questions

1 answer
View Help Tell me what you want to do Essie Njenga-Rose D Share Data Table: A....
View Help Tell me what you want to do Essie Njenga-Rose D Share Data Table: A. Effect of Temperature on Reaction Rate Experimental Trial Temperature Time Rate Hot Water (Trial 1) Hot Water (Trial 2) 108F 18sec Room Temp (Trial 1) Room Temp (Trial 2) 96.0F 54 sec Cold (Trial 1) Cold (Trial 2) 93sec I...
1 answer
You're asked to add 15 mEq of potassium chloride per 100 mL of Normosol
You're asked to add 15 mEq of potassium chloride per 100 mL of Normosol. Potassium chloride is available as 20 mEq/ 10mls. The amount of Potassium chloride needed for a 3 L bag of Normosol would be ?...
1 answer
Problem 17 Intro Assume that the CAPM holds. One stock has an expected return of 9%...
Problem 17 Intro Assume that the CAPM holds. One stock has an expected return of 9% and a beta of 0.6. Another stock has an expected return of 12% and a beta of 1.5. Attempt 1/10 for 10 pts. Part 1 What is the reward-to-risk ratio?...
1 answer
Consider the following information for a period of years: Arithmetic Mean Long-term government bonds Long-term corp...
Consider the following information for a period of years: Arithmetic Mean Long-term government bonds Long-term corporate bonds Inflation 6.8% 6.9 3.6 a. What is the real return on long-term government bonds? (Do not round intermediate calculations and enter your answer as a percent rounded to 2 deci...
1 answer
9 Dividend Yield The market price for Macro Corporation closed at $53.60 and $75.00 on December...
9 Dividend Yield The market price for Macro Corporation closed at $53.60 and $75.00 on December 31, current year, and previous year, respectively. The dividends per share were $0.67 for current year and $0.75 for previous year. a. Determine the dividend yield for Macro on December 31, current year, ...
1 answer
Budget deficits tend to: a. decrease over time. b. increase during expansions. c. increase over time....
Budget deficits tend to: a. decrease over time. b. increase during expansions. c. increase over time. d. increase during recessions. e. grow as the economy grows and shrink as the economy shrinks....
1 answer
Please answer both 5 AND 6 Check my work Part 1 of 2 Required information Problem...
Please answer both 5 AND 6 Check my work Part 1 of 2 Required information Problem 6-30 (LO 6-1) [The following information applies to the questions displayed below.) points This year Jack intends to file a married-joint return. Jack received $179,600 of salary, and paid $8,150 of interest on loans u...
1 answer
1. (1 point) Select a conductor from the ACSR table capable of carrying 750 Amps of current at 75% load. 2. (2 point) Verify the cross-sectional area of ACSR Martin expressed in circular mils of alumi...
1. (1 point) Select a conductor from the ACSR table capable of carrying 750 Amps of current at 75% load. 2. (2 point) Verify the cross-sectional area of ACSR Martin expressed in circular mils of aluminum. Determine the equivalent cross-sectional area in square meters. Characteristics of aluminum ca...
1 answer
Pecan Inc. produces water valves. Overhead costs have been identified as follows: Activity Pool Quality control...
Pecan Inc. produces water valves. Overhead costs have been identified as follows: Activity Pool Quality control Machine maintenance Setups Cost $ 59,570 $108,300 $ 91,500 Activity Driver Number of inspections Number of machine hours Number of production runs Activity 185 19,000 60 Pecan makes 3 mode...
1 answer
You have a choice to hire a doctor that would be able to see 2184 patients...
You have a choice to hire a doctor that would be able to see 2184 patients annually with an annual salary of $180,000 or a Registered Nurse with an annual salary of $67,000 that would be able to see 1561 patients per year. All else equal, would you hire a Registered Nurse or a Doctor?...
1 answer
C++ 4. (5 points) Identify the following items in the programming code shown below: a. Function...
C++ 4. (5 points) Identify the following items in the programming code shown below: a. Function prototype, function heading, function body, and function definitions. b. Function call statements, formal parameters, and actual parameters. C. Value parameters and reference parameters. d. Local variabl...
1 answer
5. Use the following data for two industries (A and B) to answer the questions. Industry...
5. Use the following data for two industries (A and B) to answer the questions. Industry A Industry B WA L WB Live $8.00/hr 15,000 $9.00/hr 20,000 $9.00/hr 10,000 $10.00/hr 10,000 (a) In which industry would a union be more likely to organize workers? Why? (b) In which industry would a union be more...
1 answer
On c
on c...
1 answer
15. 17 and 21) (References Scoring: Your score will be based on the number of correct...
15. 17 and 21) (References Scoring: Your score will be based on the number of correct matches minus the number of incorrect m Use the References to access important values if needed for Arrange the following compounds in order of increasing boiling points. Clear All CH3-CH-CH2-CH2-CH lowest boiling ...
1 answer
6. Which of the four carbocations shown is the most stable (will not rearrange) and which...
6. Which of the four carbocations shown is the most stable (will not rearrange) and which one(s) will undergo carbocation rearrangement(s)? Indicate the correct structures of the products of the carbocation rearrangements. To practice for the exam: use resonance structures to explain why you selecte...
1 answer
How to make this program for c++ visual studio 2015. Also, can I show your working...
how to make this program for c++ visual studio 2015. Also, can I show your working and program. Also, Can you have notice for pseudo code? For the first problem, please implement Problem 4 on page 142 (p 143, 7E) of the text. A scan of the problem is provided below. This problem asks you to calculat...
1 answer
I NEED HELP WITH A RESPONSE TO THE POST BELOW. How do bonds provide financing to...
I NEED HELP WITH A RESPONSE TO THE POST BELOW. How do bonds provide financing to corporations for their capital projects? Issuing bonds is the easiest most effective way to raise money to do the things needed to allow the company to grow without taking a loan from the bank with higher interest rates...
1 answer
10. What is the price elasticity of demand at point B? (a) -3 (b) -0.33 (c)...
10. What is the price elasticity of demand at point B? (a) -3 (b) -0.33 (c) -0.05 (d) None of the above. 11. At which point is the price elasticity of demand unit elastic? (a) A (b) B (c) C (d) None of the above. Use the following information to answer Questions 10 and 11. Consid...