We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Reduce Function
Reduce Function
Sort by
recency
|
207 Discussions
|
Please Login in order to post a comment
from fractions import Fraction from functools import reduce def product(fracs): t = reduce (lambda x, y : x * y, 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)
def product(fracs):