DEV Community

Discussion on: Daily Challenge #242 - Expressions Matter

Collapse
 
kira009 profile image
Shohan • Edited

If one of the numbers is 1, and if the next bigger number is y and largest number is z, ans will be z * (1 + y), else ans will be x * y * z

So

def expressions_matter(a, b, c):
    x = sort([a, b, c])
    if x[0] == 1:
        return (1 + x[1]) * x[2]
    return x[0] * x[1] * x[2]