x = 0.25 print(x.as_integer_ratio()) # Output: (1, 4) y = x.as_integer_ratio() print(y) # Output: (1, 4) numerator, denominator = x.as_integer_ratio() print(numerator / denominator) # Output: 0.25