programming-examples/python/Math/Create the fraction instances of float numbers.py
2019-11-15 12:59:38 +01:00

3 lines
108 B
Python

import fractions
for n in [0.2, 0.7, 6.5, 6.0]:
print('{} = {}'.format(n, fractions.Fraction(n)))