You are viewing a single comment's thread. Return to all comments →
from fractions import Fraction from functools import reduce from operator import mul def product(fracs): t = reduce(mul, fracs) return t.numerator, t.denominator if __name__ == '__main__': fracs = [] for _ in range(int(input())): fracs.append(Fraction(*map(int, input().split()))) result = product(fracs) print(*result)
Seems like cookies are disabled on this browser, please enable them to open this website
Reduce Function
You are viewing a single comment's thread. Return to all comments →