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

Function moles_to_volume

conversions/molecular_chemistry.py:46–63  ·  view source on GitHub ↗

Convert moles to volume. Ideal gas laws are used. Temperature is taken in kelvin. Volume is taken in litres. Pressure has atm as SI unit. Wikipedia reference: https://en.wikipedia.org/wiki/Gas_laws Wikipedia reference: https://en.wikipedia.org/wiki/Pressure

(pressure: float, moles: float, temperature: float)

Source from the content-addressed store, hash-verified

44
45
46def moles_to_volume(pressure: float, moles: float, temperature: float) -> float:
47 """
48 Convert moles to volume.
49 Ideal gas laws are used.
50 Temperature is taken in kelvin.
51 Volume is taken in litres.
52 Pressure has atm as SI unit.
53
54 Wikipedia reference: https://en.wikipedia.org/wiki/Gas_laws
55 Wikipedia reference: https://en.wikipedia.org/wiki/Pressure
56 Wikipedia reference: https://en.wikipedia.org/wiki/Temperature
57
58 >>> moles_to_volume(0.82, 3, 300)
59 90
60 >>> moles_to_volume(8.2, 5, 200)
61 10
62 """
63 return round(float((moles * 0.0821 * temperature) / (pressure)))
64
65
66def pressure_and_volume_to_temperature(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected