Added Length class.
This commit is contained in:
parent
07cffdea01
commit
a5cb130c89
16
cyclinglib/length.py
Normal file
16
cyclinglib/length.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
class Length:
|
||||
|
||||
def __init__(self, metre: float) -> None:
|
||||
self._metre = metre
|
||||
|
||||
def kilometre(self) -> float:
|
||||
return self._metre / 1_000
|
||||
|
||||
def centimetre(self) -> float:
|
||||
return self._metre * 100
|
||||
|
||||
def millimetre(self) -> float:
|
||||
return self._metre * 1_000
|
||||
|
||||
def miles(self) -> float:
|
||||
return self._metre * 0.000621371192
|
||||
Loading…
Reference in a new issue