Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

NOTE : Is learning Python programming (currently on chapter 5) with the following textbook: Book Starting Out With Python 3rd Edition by Gaddis

NOTE: Is learning "Python programming" (currently on chapter 5) with the following textbook:

Book "Starting Out With Python" 3rd Edition by Gaddis

image text in transcribed

2. A nutritionist who works for a fitness club helps members by evaluating their diets. As part of her evaluation, she asks members for the number of fat grams and carbohydrate grams that they consumed in a day. Then, she calculates the number of calories that result from the fat, using the following formula: calories from fat = fat grams * 9 Next, she calculates the number of calories that result from the carbohydrates, using the following formula: calories from carbs - carb grams * 4 The nutritionist asks you to write a program that will make these calculations. Use a function that will allow you to display both calculations (by passing in the number of grams and the number of calories per gram) /workspace/HH/ $ python numbero Enter number of fat grams you ate today: 10 Enter number of carb grams you ate today: 20 10 grams have 90 calories 20 grams have 80 calories

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions