From a5cb130c899ce8dfb70dcc7d987b207c2edab34f Mon Sep 17 00:00:00 2001 From: Filip Date: Fri, 21 Feb 2025 22:51:49 +0100 Subject: [PATCH] Added Length class. --- cyclinglib/length.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 cyclinglib/length.py diff --git a/cyclinglib/length.py b/cyclinglib/length.py new file mode 100644 index 0000000..4dacf89 --- /dev/null +++ b/cyclinglib/length.py @@ -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