Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions maths/decimal_to_fraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@
>>> decimal_to_fraction("78td")
Traceback (most recent call last):
ValueError: Please enter a valid number
>>> decimal_to_fraction(-2.5)
(-5, 2)
>>> decimal_to_fraction(0.125)
(1, 8)
>>> decimal_to_fraction(1000000.25)
(4000001, 4000)
>>> decimal_to_fraction(1.3333)
(13333, 10000)

Check failure on line 26 in maths/decimal_to_fraction.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (W291)

maths/decimal_to_fraction.py:26:19: W291 Trailing whitespace
>>> decimal_to_fraction("1.23e2")
(123, 1)
>>> decimal_to_fraction("0.500")
"""
try:
decimal = float(decimal)
Expand Down
Loading