Hi, here's your problem today. This problem was recently asked by Facebook:
Given a numerator and a denominator, find what the equivalent decimal representation is as a string. If the decimal representation has recurring digits, then put those digits in brackets (ie 4/3 should be represented by 1.(3) to represent 1.333...). Do not use any built in evaluator functions like python's eval. You can also assume that the denominator will be nonzero.
Here's some examples and some starter code:
def frac_to_dec(numerator, denominator): # Fill this in. print(frac_to_dec(-3, 2)) # -1.5 print(frac_to_dec(4, 3)) # 1.(3) print(frac_to_dec(1, 6)) # 0.1(6)