-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha02q3.py
More file actions
40 lines (23 loc) · 869 Bytes
/
a02q3.py
File metadata and controls
40 lines (23 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python
# coding: utf-8
# In[40]:
import check
def eutectic(pct_eth:float, temp: float) -> bool:
"""Return the state of the mixture of ethanol (pct_eth) in percentage and water at a given temperature (temp) in Celcius
Requires temperature <= 0
Requires percentage of ethanol >= 0 and <= 100"""
if temp<= -118.2:
return "solid"
elif ((-114.1<temp> -118.2) <= (4.1/6.9)*(93.1<pct_eth<100)):
return "slush"
elif (temp>= (-118.2/93.1)*pct_eth):
return "liquid"
elif (temp<= (-118.2/93.1)*pct_eth):
return "slush"
check.expect("E1", eutectic(60, -140.0), "solid")
check.expect("E2", eutectic(0,0), "liquid")
check.expect("E3", eutectic(98.0, -118.0), "slush")
check.expect("E4", eutectic(45, -10.0), "liquid")
check.expect("E5", eutectic(20, -120.0), "solid")
# In[ ]:
# In[ ]: