conversions.astronomical_length_scale_conversion

Conversion of length units. Available Units: Metre, Kilometre, Megametre, Gigametre, Terametre, Petametre, Exametre, Zettametre, Yottametre

USAGE : -> Import this file into their respective project. -> Use the function length_conversion() for conversion of length 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/Meter -> Wikipedia reference: https://en.wikipedia.org/wiki/Kilometer -> Wikipedia reference: https://en.wikipedia.org/wiki/Orders_of_magnitude_(length)

Attributes

METRIC_CONVERSION

UNIT_SYMBOL

Functions

length_conversion(→ float)

Conversion between astronomical length units.

Module Contents

conversions.astronomical_length_scale_conversion.length_conversion(value: float, from_type: str, to_type: str) float

Conversion between astronomical length units.

>>> length_conversion(1, "meter", "kilometer")
0.001
>>> length_conversion(1, "meter", "megametre")
1e-06
>>> length_conversion(1, "gigametre", "meter")
1000000000
>>> length_conversion(1, "gigametre", "terametre")
0.001
>>> length_conversion(1, "petametre", "terametre")
1000
>>> length_conversion(1, "petametre", "exametre")
0.001
>>> length_conversion(1, "terametre", "zettametre")
1e-09
>>> length_conversion(1, "yottametre", "zettametre")
1000
>>> length_conversion(4, "wrongUnit", "inch")
Traceback (most recent call last):
  ...
ValueError: Invalid 'from_type' value: 'wrongUnit'.
Conversion abbreviations are: m, km, Mm, Gm, Tm, Pm, Em, Zm, Ym
conversions.astronomical_length_scale_conversion.METRIC_CONVERSION
conversions.astronomical_length_scale_conversion.UNIT_SYMBOL