Question
Design a function called hours_remaining that takes three arguments: a. an integer value between 0 and 100 representing the percentage of battery life remaining b.
Design a function called hours_remaining that takes three arguments:
a. an integer value between 0 and 100 representing the percentage of battery life remaining
b. the brightness level of the mobile device
c. a boolean value representing whether or not the mobile device is currently streaming video
(True means streaming video, False means not streaming video)
The function returns a floating-point value representing the total number of hours of battery life left. The following algorithm is used to determine the number of hours of batter life left:
i. Multiply the MAXIMUM_BATTERY_LIFE (15 hours) by the percentage of battery left.
ii. Apply the brightness_modifier based on the current brightness level of the device.
iii. If the phone is currently streaming video, the hours remaining is cut in half.
For example, hours_remaining(80, 2, True) returns the following:
15 80% = 12 hours of regular battery remaining (80% of maximum).
12 0.75 = 9 hours after the brightness modifier is applied (brightness level of 2)
9 0.5 = 4.5 hours since the mobile device is currently streaming video
4.5 is returned. Do not round the result.
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