conversions.volume_conversions¶
Conversion of volume units. Available Units:- Cubic metre,Litre,KiloLitre,Gallon,Cubic yard,Cubic foot,cup USAGE : -> Import this file into their respective project. -> Use the function length_conversion() for conversion of volume units. -> Parameters :
-> value : The number of from units you want to convert -> from_type : From which type you want to convert -> to_type : To which type you want to convert
REFERENCES : -> Wikipedia reference: https://en.wikipedia.org/wiki/Cubic_metre -> Wikipedia reference: https://en.wikipedia.org/wiki/Litre -> Wikipedia reference: https://en.wiktionary.org/wiki/kilolitre -> Wikipedia reference: https://en.wikipedia.org/wiki/Gallon -> Wikipedia reference: https://en.wikipedia.org/wiki/Cubic_yard -> Wikipedia reference: https://en.wikipedia.org/wiki/Cubic_foot -> Wikipedia reference: https://en.wikipedia.org/wiki/Cup_(unit)
Attributes¶
Classes¶
Functions¶
|
Conversion between volume units. |
Module Contents¶
- class conversions.volume_conversions.FromTo¶
Bases:
NamedTuple
- from_factor: float¶
- to_factor: float¶
- conversions.volume_conversions.volume_conversion(value: float, from_type: str, to_type: str) float ¶
Conversion between volume units. >>> volume_conversion(4, “cubic meter”, “litre”) 4000 >>> volume_conversion(1, “litre”, “gallon”) 0.264172 >>> volume_conversion(1, “kilolitre”, “cubic meter”) 1 >>> volume_conversion(3, “gallon”, “cubic yard”) 0.017814279 >>> volume_conversion(2, “cubic yard”, “litre”) 1529.1 >>> volume_conversion(4, “cubic foot”, “cup”) 473.396 >>> volume_conversion(1, “cup”, “kilolitre”) 0.000236588 >>> volume_conversion(4, “wrongUnit”, “litre”) Traceback (most recent call last):
…
ValueError: Invalid ‘from_type’ value: ‘wrongUnit’ Supported values are: cubic meter, litre, kilolitre, gallon, cubic yard, cubic foot, cup
- conversions.volume_conversions.METRIC_CONVERSION¶