Files

24 lines
859 B
Python

# HumanEval/144
# Loki Mode Multi-Agent Solution
# Attempts: 1
# Passed: True
def simplify(x, n):
"""Your task is to implement a function that will simplify the expression
x * n. The function returns True if x * n evaluates to a whole number and False
otherwise. Both x and n, are string representation of a fraction, and have the following format,
<numerator>/<denominator> where both numerator and denominator are positive whole numbers.
You can assume that x, and n are valid fractions, and do not have zero as denominator.
simplify("1/5", "5/1") = True
simplify("1/6", "2/1") = False
simplify("7/10", "10/2") = False
"""
x_num, x_den = map(int, x.split('/'))
n_num, n_den = map(int, n.split('/'))
numerator = x_num * n_num
denominator = x_den * n_den
return numerator % denominator == 0