programming-examples/python/Math/Create the fraction instances of float numbers.py

3 lines
108 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
import fractions
for n in [0.2, 0.7, 6.5, 6.0]:
print('{} = {}'.format(n, fractions.Fraction(n)))