Skip to content

Commit fc0cbef

Browse files
committed
doctest and type hints
1 parent 3b86444 commit fc0cbef

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

physics/grahams_law.py

+21-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,27 @@
1717
from math import pow, sqrt
1818

1919

20-
def validate(*values) -> bool:
20+
def validate(*values: float) -> bool:
21+
"""
22+
Input Parameters:
23+
-----------------
24+
effusion_rate_1: Effustion rate of first gas (m^2/s, mm^2/s, etc.)
25+
effusion_rate_2: Effustion rate of second gas (m^2/s, mm^2/s, etc.)
26+
molar_mass_1: Molar mass of the first gas (g/mol, kg/kmol, etc.)
27+
molar_mass_2: Molar mass of the second gas (g/mol, kg/kmol, etc.)
28+
29+
Returns:
30+
--------
31+
>>> validate(2.016, 4.002)
32+
True
33+
>>> validate(-2.016, 4.002)
34+
Traceback (most recent call last):
35+
...
36+
ValueError: Invalid inputs. Effusion rates and molar masses must be a positive
37+
value.
38+
>>> validate()
39+
False
40+
"""
2141
for value in values:
2242
if value >= 0.0:
2343
return True

0 commit comments

Comments
 (0)