From a7156970c5e3b05e6ba2736755cea5c1e1f1851c Mon Sep 17 00:00:00 2001 From: Avinash Ranjan Date: Wed, 19 May 2021 23:45:45 +0530 Subject: [PATCH] reverting --- .../Blood_Alcohol_Content.py | 34 +++++++++++++++++++ Blood Alcohol Content/README.md | 22 ++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 Blood Alcohol Content/Blood_Alcohol_Content.py create mode 100644 Blood Alcohol Content/README.md diff --git a/Blood Alcohol Content/Blood_Alcohol_Content.py b/Blood Alcohol Content/Blood_Alcohol_Content.py new file mode 100644 index 0000000000..2900fe3f4a --- /dev/null +++ b/Blood Alcohol Content/Blood_Alcohol_Content.py @@ -0,0 +1,34 @@ +class BAC(object): + def __init__(self,weight, time, vol, amount, gender): + self.weight = weight + self.time = time + self.vol = vol + self.amount = amount + self.gender = gender + self.std = 0.0068 + def standard_drink(self): + return round((self.std * self.vol) * self.amount, 2) + def promille_man(self): + return round((self.standard_drink() * 12) / ((self.weight*1.7) - (0.15*self.time)), 2) + def promille_woman(self): + return round((self.standard_drink() * 12) / ((self.weight*1.6) - (0.15*self.time)), 2) + + + def result(self): + if self.gender == 'woman': + print(f'\nAs a woman who have had {self.amount} cl. of {self.vol}% vol, {self.time} hour ago.') + print(f'You`ve had {self.standard_drink()} drinks,which gives you a {self.promille_woman()}% BAC\n') + elif self.gender == 'man': + print(f'\nAs a man who have had {self.amount} cl. of {self.vol}% vol, {self.time} hour ago.') + print(f'You`ve had {self.standard_drink()} drinks,which gives you a {self.promille_man()}% BAC\n') + else: + print("Fault.") + +if __name__ == "__main__": + weight = int(input("Weight of the patient in kg: ")) + time = int(input("Enter the time of drink (in hour only): ")) + vol = float(input("Volume percent of alcohol in the drink:")) + amount = int(input("Enter the amount the you drank: ")) + gender = str(input("You are man or woman: ")) + + BAC(weight,time,vol,amount,gender).result() diff --git a/Blood Alcohol Content/README.md b/Blood Alcohol Content/README.md new file mode 100644 index 0000000000..9eeb149924 --- /dev/null +++ b/Blood Alcohol Content/README.md @@ -0,0 +1,22 @@ +# Blood Alcohol Content + +Want to know how much amount of alcohol you drank? Well, the Blood alcohol content program will help you find out the alcohol intake. + +## Installation + +- Install Python to your system if it's not available. + +**Now you are ready to run the code** + +## Steps to run: + +- Open the **Blood_Alcohol_Content.py** file i.e run it. +- To run it, you can open command prompt/shell/terminal in the containing folder and type the following command: + ``` + python Blood_Alcohol_Content.py + ``` +## Output: +``` +As a woman who have had 50 cl. of 4.6% vol, 1 hour ago. +You've had 1.56 drinks,which gives you a 0.14% BAC +``` \ No newline at end of file