Skip to content

Commit a715697

Browse files
reverting
1 parent 73ca156 commit a715697

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
class BAC(object):
2+
def __init__(self,weight, time, vol, amount, gender):
3+
self.weight = weight
4+
self.time = time
5+
self.vol = vol
6+
self.amount = amount
7+
self.gender = gender
8+
self.std = 0.0068
9+
def standard_drink(self):
10+
return round((self.std * self.vol) * self.amount, 2)
11+
def promille_man(self):
12+
return round((self.standard_drink() * 12) / ((self.weight*1.7) - (0.15*self.time)), 2)
13+
def promille_woman(self):
14+
return round((self.standard_drink() * 12) / ((self.weight*1.6) - (0.15*self.time)), 2)
15+
16+
17+
def result(self):
18+
if self.gender == 'woman':
19+
print(f'\nAs a woman who have had {self.amount} cl. of {self.vol}% vol, {self.time} hour ago.')
20+
print(f'You`ve had {self.standard_drink()} drinks,which gives you a {self.promille_woman()}% BAC\n')
21+
elif self.gender == 'man':
22+
print(f'\nAs a man who have had {self.amount} cl. of {self.vol}% vol, {self.time} hour ago.')
23+
print(f'You`ve had {self.standard_drink()} drinks,which gives you a {self.promille_man()}% BAC\n')
24+
else:
25+
print("Fault.")
26+
27+
if __name__ == "__main__":
28+
weight = int(input("Weight of the patient in kg: "))
29+
time = int(input("Enter the time of drink (in hour only): "))
30+
vol = float(input("Volume percent of alcohol in the drink:"))
31+
amount = int(input("Enter the amount the you drank: "))
32+
gender = str(input("You are man or woman: "))
33+
34+
BAC(weight,time,vol,amount,gender).result()

Blood Alcohol Content/README.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Blood Alcohol Content
2+
3+
Want to know how much amount of alcohol you drank? Well, the Blood alcohol content program will help you find out the alcohol intake.
4+
5+
## Installation
6+
7+
- Install Python to your system if it's not available.
8+
9+
**Now you are ready to run the code**
10+
11+
## Steps to run:
12+
13+
- Open the **Blood_Alcohol_Content.py** file i.e run it.
14+
- To run it, you can open command prompt/shell/terminal in the containing folder and type the following command:
15+
```
16+
python Blood_Alcohol_Content.py
17+
```
18+
## Output:
19+
```
20+
As a woman who have had 50 cl. of 4.6% vol, 1 hour ago.
21+
You've had 1.56 drinks,which gives you a 0.14% BAC
22+
```

0 commit comments

Comments
 (0)