I need to us python to convert an improper fraction to a mixed number or even a float to a mixed number. My code is as follows:
from fractions import Fraction nu
Try to implement it manually:
a = numerator // denominator b = numerator % denominator print '{} {}/{}'.format(a, b, denominator)
Currently you are just printing 'x/b', if the input is a float do the adequate translation first.
Hope it can help.