• + 0 comments

    The simple line needed to complete the skeleton function is…

    t = reduce(Fraction.__mul__, fracs)
    

    Let Python do the work. There's no need to construct a lambda.

    There are several solutions posted in this forum that do the reduction using the Fraction constructor to do the multiplication. It works, but it requires a little bit of special knowledge to set up the calculation and to return the result. The reduction must start with 1, to get the reciprocal of the first fraction. After the reduction, the reciprocal is returned by giving the numerator and denominator in the opposite order. Although the solution is clever and somewhat smaller, i don't recommend it, because the way it works isn't obvious to most people and is therefore difficult to maintain