Question

In: Computer Science

Running on a particular treadmill you burn a specific number of calories per minute. Write a...

Running on a particular treadmill you burn a specific number of calories per minute. Write a python program that uses a loop (you must use a loop) to display the number of minutes (as an integer) it will take to burn greater than or equal to 100 calories. For example (user input indicated in bold):

SAMPLE 1:

How many calcories burned per minute? 54.3
2 minutes

SAMPLE 2:

How many calcories burned per minute? 4.3
24 minutes

SAMPLE 3:

How many calcories burned per minute? 25
4 minutes

HINT:

Keep a counter of the number of minutes elapsed as well as the amount of calories burned. When the calories burned exceed 100, report the number of minutes :)

Solutions

Expert Solution

import math;

#while(1) means loop runs continuously
while(1):
    
    #takes calories burned per minutes from user
    cal_per_min = float(input("How many calcories burned per minute? "))
    
    #calculates minutes required to burn calories greater than or equal to 100
    #math.ceil() will return the ceiling value of the division (100/cal_per_min)
    minute = math.ceil(100 / cal_per_min) ;
    
    #prints minutes
    print(minute , "minutes")
    


Related Solutions

Running on a particular treadmill you burn a specific number of calories per minute. Write a...
Running on a particular treadmill you burn a specific number of calories per minute. Write a python program that uses a loop (you must use a loop) to display the number of minutes (as an integer) it will take to burn greater than or equal to 100 calories. For example (user input indicated in bold): SAMPLE 1: How many calcories burned per minute? 54.3 2 minutes SAMPLE 2: How many calcories burned per minute? 4.3 24 minutes SAMPLE 3: How...
Calories Burned Running on a particular treadmill, you burn 4 calories per minute. Write a program...
Calories Burned Running on a particular treadmill, you burn 4 calories per minute. Write a program that uses a loop to display the number of calories burned after 5, 10, 15, 20, 25, and 30 minutes. Note the answer should be in assembly language using windows 32 and .586
In 80X86 assembly language Calories Burned Running on a particular treadmill, you burn 4 calories per...
In 80X86 assembly language Calories Burned Running on a particular treadmill, you burn 4 calories per minute. Write a program that uses a loop to display the number of calories burned after 5, 10, 15, 20, 25, and 30 minutes pls show input and output
Why is it surprising that hunter-gatherers burn the same number of calories per day as a...
Why is it surprising that hunter-gatherers burn the same number of calories per day as a sedentary person in a western society?
You have a dataset of the average number of chirps per minute for a sample of...
You have a dataset of the average number of chirps per minute for a sample of 30 crickets. You find that the mean number of chirps per minute is 40 and that the number of chirps per minute has a standard deviation of 5 chirps. You want to test that the mean number of chirps per minute for a cricket is greater than 38 using a significance level of .05. What is the value of your test statistic? Round your...
PREGUNTA 1 Number of hours per week on the treadmill and cholesterol level is an example...
PREGUNTA 1 Number of hours per week on the treadmill and cholesterol level is an example of: A. Positive Correlation B. Negative Correlation C. No Correlation D. None of the above   PREGUNTA 2 Shoe size and IQ is an example of: A. Positive Correlation B. Negative Correlation C. No Correlation D. None of the above PREGUNTA 3 Number of children in the household under the age of 3 and expenditures on diapers is an example of: A. Positive Correlation B....
Thirty-minute workouts of one of the following will lead to burning the following calories. You wish...
Thirty-minute workouts of one of the following will lead to burning the following calories. You wish to test to see if there is a difference in the amount of calories burned from these three activities. Swimming Tennis Cycling 408 415 385 380 485 250 425 450 380 400 420 402 427 530 268 What is the p-value and your conclusion? p value = 0.0098 and conclude fail to reject the null the three activities are identical and tennis tends to...
The activity of a radioactive sample is the number of decays per minute that occur in...
The activity of a radioactive sample is the number of decays per minute that occur in the sample. We measured this by detecting the radiation entering the Geiger tube window. Explain why our readings were actually only a small fraction of the actual activity. Also, why did that not seem to matter in the determination of Barium-137m’s half-life? Refer to either your A vs. t or your ln A vs. t graph in your explanation.
An animal’s maintenance caloric intake is defined as the number of calories per day required to...
An animal’s maintenance caloric intake is defined as the number of calories per day required to maintain its weight at a constant value. We wish to discover whether the median maintenance caloric intake, m, for a population of rats is less than 10g/day. We draw a SRS of 17 rats, feed each rat 10g of dry food per day for30 days, and find that 4 of the rats lost weight, while the rest gained weight. (a) State null and alternative...
The Decadent Desserts cookbook has recipes for desserts. The number of calories per serving for the...
The Decadent Desserts cookbook has recipes for desserts. The number of calories per serving for the recipes in the cookbook is normally distributed with a mean of 378 and a standard deviation of 34.5. If 18 recipes are randomly selected to serve at a reception, what is the probability that the average calories per serving for the sample is over 385?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT