You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
260 B
Python
11 lines
260 B
Python
5 years ago
|
iimport decimal
|
||
|
import fractions
|
||
|
values = [
|
||
|
decimal.Decimal('0.2'),
|
||
|
decimal.Decimal('0.7'),
|
||
|
decimal.Decimal('2.5'),
|
||
|
decimal.Decimal('3.0'),
|
||
|
]
|
||
|
|
||
|
for d in values:
|
||
|
print('{} = {}'.format(d, fractions.Fraction(d)))
|