A Python module containing a couple of functions to calculate the blood alcohol content of people.
It’s at home at GitHub: https://github.com/brutus/boozelib/
The two main functions are:
Returns the Blood Alcohol Content (raise) for a person (described by the given attributes) after a drink containing volume ml of alcohol with the given percent (vol/vol).
Returns the alcohol degradation (per mill) of a person with the given stats in the given number of minutes.
You can browse the full documentation online. Or you can get help with pydoc boozelib, if you already got boozelib installed.
>>> from boozelib import get_bac, get_degradation
>>> get_bac(32, 96, 186, False, 500, 4.9)
0.28773587455687716
>>> get_bac(32, 48, 162, True, 500, 4.9)
0.5480779730398769
>>> get_degradation(32, 96, 186, False, 60)
0.21139778538872606
>>> get_degradation(32, 48, 162, True, 60)
0.20133476560648536
If you find any bugs, issues or anything, please use the issue tracker on GitHub.