mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-25 10:28:39 +00:00
Compare commits
5 Commits
9f684576bb
...
5ce54f2180
Author | SHA1 | Date | |
---|---|---|---|
|
5ce54f2180 | ||
|
b637591ae9 | ||
|
c8c29e9611 | ||
|
a2d6d5b574 | ||
|
2beb2071ce |
@ -67,16 +67,16 @@ def temperature_of_gas_system(moles: float, volume: float, pressure: float) -> f
|
|||||||
if moles < 0 or volume < 0 or pressure < 0:
|
if moles < 0 or volume < 0 or pressure < 0:
|
||||||
raise ValueError("Invalid inputs. Enter positive value.")
|
raise ValueError("Invalid inputs. Enter positive value.")
|
||||||
|
|
||||||
return (pressure * volume) / (moles * UNIVERSAL_GAS_CONSTANT)
|
return pressure * volume / (moles * UNIVERSAL_GAS_CONSTANT)
|
||||||
|
|
||||||
|
|
||||||
def num_moles_of_gas_in_system(kelvin: float, volume: float, pressure: float) -> float:
|
def moles_of_gas_system(kelvin: float, volume: float, pressure: float) -> float:
|
||||||
"""
|
"""
|
||||||
>>> temperature_of_gas_system(100, 5, 10)
|
>>> moles_of_gas_system(100, 5, 10)
|
||||||
0.06013618199229246
|
0.06013618199229246
|
||||||
>>> temperature_of_gas_system(110,5009,1000)
|
>>> moles_of_gas_system(110,5009,1000)
|
||||||
5476.766101807144
|
5476.766101807144
|
||||||
>>> temperature_of_gas_system(3, -0.46, 23.5)
|
>>> moles_of_gas_system(3, -0.46, 23.5)
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
...
|
...
|
||||||
ValueError: Invalid inputs. Enter positive value.
|
ValueError: Invalid inputs. Enter positive value.
|
||||||
@ -84,7 +84,7 @@ def num_moles_of_gas_in_system(kelvin: float, volume: float, pressure: float) ->
|
|||||||
if kelvin < 0 or volume < 0 or pressure < 0:
|
if kelvin < 0 or volume < 0 or pressure < 0:
|
||||||
raise ValueError("Invalid inputs. Enter positive value.")
|
raise ValueError("Invalid inputs. Enter positive value.")
|
||||||
|
|
||||||
return (pressure * volume) / (kelvin * UNIVERSAL_GAS_CONSTANT)
|
return pressure * volume / (kelvin * UNIVERSAL_GAS_CONSTANT)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user