Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Okay, so I am pretty sure that i could handle this but could you please help me

ID: 2247284 • Letter: O

Question

Okay, so I am pretty sure that i could handle this but could you please help me with writing this code? IVe been coding all night and my eyes are burning from looking at this screen...and if you know of any good references on python that would be great!

Function name (5): calorie_counter Parameters: N/A
Return value: N/A

>>>Write a function that takes the number of meals and number of miles to calculate a person’s caloric intake in a day.

1)Get the number of meals a person ate from the user.

2)Get the number of miles a person ran.

3)Calculate a person’s caloric intake using the following:

The average calories gained per meal is 500 calories.

A person that has done no exercise has burned about 1600 calories.

The average calories burned per mile of running is 95 calories.

If a person gains the same or more calories than they burn then you should print a positive number. If a person burns more than they gain you should print a negative number.

Print the result in the following format: “After eating 5 meals and running 2 miles, a person gained 2500 calories and burned 1790 calories, leading to an intake of 710 calories.”

Explanation / Answer

Here is your calorie_counter function:

calorie_counter:

#In python 3.0

def calorie_counter():

meals=0;

miles=0;

calories=0;

burn=1600;

intake=0;

meals=int(input("Enter number of meals you ate "))

miles=int(input("Enter number of miles you ran "))

calories=meals*500

burn=int(calories)

if(miles==0):

burn=1600

else:

burn=miles*95+1600

intake=calories-burn

rslt="""

After eating """+str(meals)+""" meals and running"""+str(miles)+""" miles,

a person gained """+str(calories)+""" calories and burned """+str(burn)+""" calories,

leading to an intake """+str(intake)+""" of calories

"""

print(rslt)

calorie_counter()

I hope this solves your problem

Comment if you have any problem in above code

And please give it a thumbs up if it solves your problem :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote