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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!