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

Function effusion_ratio

physics/grahams_law.py:42–64  ·  view source on GitHub ↗

Input Parameters: ----------------- molar_mass_1: Molar mass of the first gas (g/mol, kg/kmol, etc.) molar_mass_2: Molar mass of the second gas (g/mol, kg/kmol, etc.) Returns: -------- >>> effusion_ratio(2.016, 4.002) 1.408943 >>> effusion_ratio(-2.016, 4.002)

(molar_mass_1: float, molar_mass_2: float)

Source from the content-addressed store, hash-verified

40
41
42def effusion_ratio(molar_mass_1: float, molar_mass_2: float) -> float | ValueError:
43 """
44 Input Parameters:
45 -----------------
46 molar_mass_1: Molar mass of the first gas (g/mol, kg/kmol, etc.)
47 molar_mass_2: Molar mass of the second gas (g/mol, kg/kmol, etc.)
48
49 Returns:
50 --------
51 >>> effusion_ratio(2.016, 4.002)
52 1.408943
53 >>> effusion_ratio(-2.016, 4.002)
54 ValueError('Input Error: Molar mass values must greater than 0.')
55 >>> effusion_ratio(2.016)
56 Traceback (most recent call last):
57 ...
58 TypeError: effusion_ratio() missing 1 required positional argument: 'molar_mass_2'
59 """
60 return (
61 round(sqrt(molar_mass_2 / molar_mass_1), 6)
62 if validate(molar_mass_1, molar_mass_2)
63 else ValueError("Input Error: Molar mass values must greater than 0.")
64 )
65
66
67def first_effusion_rate(

Callers

nothing calls this directly

Calls 1

validateFunction · 0.70

Tested by

no test coverage detected