Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Count the f's --- an exercise in perception solution in Clear category for Fractions Addition by veky
from fractions import Fraction
from itertools import starmap
def add_fractions(fracts):
result = floor, rest = divmod(sum(starmap(Fraction, fracts)), 1)
return ' and '.join(map(str, filter(None, result))) if rest else floor
May 11, 2018
Comments: