Números racionais do Python

from fractions import Fraction

Fraction("0.2").as_integer_ratio()
# (1, 5)
# so much better
Puzzled Puffin