Created
May 1, 2023 13:05
-
-
Save Lucus16/b073bbfde29254bb41f4a50f7ee5ce6f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def caffeine(hours): | |
sip = hours * (1 - 0.5**(1 / 5)) | |
gulp = 1 - 0.5**((24 - hours) / 5) | |
total = sip + gulp | |
print("If you want to maintain a consistent amount of caffeine in your") | |
print("blood for {} hours after you wake up, you'll need to drink {:.1%}" | |
.format(hours, gulp / total) | |
) | |
print("of the amount of caffeine you want to drink in a day when you") | |
print("wake up, and {:.1%} during the {} hours thereafter, which is about" | |
.format(sip / total, hours) | |
) | |
print("{:.1%} every hour. This will allow you to maintain {:.1%} of the" | |
.format(sip / total / hours, 1 / total) | |
) | |
print("amount of caffeine you want to drink in a day in your blood") | |
print("during those {} hours.".format(hours)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment