MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / second_molar_mass

Function second_molar_mass

physics/grahams_law.py:175–208  ·  view source on GitHub ↗

Input Parameters: ----------------- molar_mass: Molar mass of the first gas (g/mol, kg/kmol, etc.) effusion_rate_1: Effustion rate of first gas (m^2/s, mm^2/s, etc.) effusion_rate_2: Effustion rate of second gas (m^2/s, mm^2/s, etc.) Returns: -------- >>> second_mol

(
    molar_mass: float, effusion_rate_1: float, effusion_rate_2: float
)

Source from the content-addressed store, hash-verified

173
174
175def second_molar_mass(
176 molar_mass: float, effusion_rate_1: float, effusion_rate_2: float
177) -> float | ValueError:
178 """
179 Input Parameters:
180 -----------------
181 molar_mass: Molar mass of the first gas (g/mol, kg/kmol, etc.)
182 effusion_rate_1: Effustion rate of first gas (m^2/s, mm^2/s, etc.)
183 effusion_rate_2: Effustion rate of second gas (m^2/s, mm^2/s, etc.)
184
185 Returns:
186 --------
187 >>> second_molar_mass(2, 1.408943, 0.709752)
188 1.970351
189 >>> second_molar_mass(-2, 1.408943, 0.709752)
190 ValueError('Input Error: Molar mass and effusion rate values must greater than 0.')
191 >>> second_molar_mass(1)
192 Traceback (most recent call last):
193 ...
194 TypeError: second_molar_mass() missing 2 required positional arguments: \
195'effusion_rate_1' and 'effusion_rate_2'
196 >>> second_molar_mass(1, 2.016)
197 Traceback (most recent call last):
198 ...
199 TypeError: second_molar_mass() missing 1 required positional argument: \
200'effusion_rate_2'
201 """
202 return (
203 round(pow(effusion_rate_1 / effusion_rate_2, 2) / molar_mass, 6)
204 if validate(molar_mass, effusion_rate_1, effusion_rate_2)
205 else ValueError(
206 "Input Error: Molar mass and effusion rate values must greater than 0."
207 )
208 )

Callers

nothing calls this directly

Calls 1

validateFunction · 0.70

Tested by

no test coverage detected