Skip to content

Commit c638201

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 82220d5 commit c638201

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: conversions/time_conversions.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""
2-
A unit of time is any particular time interval, used as a standard
3-
way of measuring or expressing duration.
2+
A unit of time is any particular time interval, used as a standard
3+
way of measuring or expressing duration.
44
The base unit of time in the International System of Units (SI),
55
and by extension most of the Western world, is the second,
6-
defined as about 9 billion oscillations of the caesium atom.
6+
defined as about 9 billion oscillations of the caesium atom.
77
88
WIKI: https://en.wikipedia.org/wiki/Unit_of_time
99
"""
@@ -24,6 +24,7 @@
2424
"weeks": 1 / 604800.0, # 1 week = 1/604800 seconds
2525
}
2626

27+
2728
def convert_time(time_value: float, unit_from: str, unit_to: str) -> float:
2829
"""
2930
Convert time from one unit to another using the time_chart above.
@@ -47,8 +48,10 @@ def convert_time(time_value: float, unit_from: str, unit_to: str) -> float:
4748
raise ValueError(msg)
4849
return round(time_value * time_chart[unit_from] * time_chart_inverse[unit_to], 3)
4950

51+
5052
if __name__ == "__main__":
5153
import doctest
54+
5255
doctest.testmod()
5356

5457
print(convert_time(3600, "seconds", "hours"))

0 commit comments

Comments
 (0)