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

Function validate

physics/grahams_law.py:20–39  ·  view source on GitHub ↗

Input Parameters: ----------------- 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.) molar_mass_1: Molar mass of the first gas (g/mol, kg/kmol, etc.) molar_mass_2: Molar mass of the second

(*values: float)

Source from the content-addressed store, hash-verified

18
19
20def 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 False
35 >>> validate()
36 False
37 """
38 result = len(values) > 0 and all(value > 0.0 for value in values)
39 return result
40
41
42def effusion_ratio(molar_mass_1: float, molar_mass_2: float) -> float | ValueError:

Callers 5

effusion_ratioFunction · 0.70
first_effusion_rateFunction · 0.70
second_effusion_rateFunction · 0.70
first_molar_massFunction · 0.70
second_molar_massFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected