Question
Programming Language = Python Assuming that: Caffeine is absorbed into the body immediately. Once absorbed, 20% is eliminated from the body each hour. Write a
Programming Language = Python
-
Assuming that:
-
Caffeine is absorbed into the body immediately.
-
Once absorbed, 20% is eliminated from the body each hour.
-
-
Write a program that asks the user for the amount of coffee consumed, in milligrams (mg), and then compute (and output) the following:
-
The number of hours required until there is less than half of the caffeine left in the body
-
The amount of caffeine left in the body after 8 hours
-
-
Then, assuming that the person drinks a cup of coffee at 8 am and then drinks a cup of coffee at the end of each hour until 6 pm, compute and output the following.
-
How much caffeine will there be in the body at the end of the 10 hours?
-
-
A sample run would be as follows.
Enter the amount of caffeine in mg: 200
Less than half of it will be left after 4 hours.
The amount of caffeine left in the body after 8 hours: 33.55 mg
The amount remaining after 10 hours: 914.10 mg
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started