← Back to all posts
Help!

def reciprocal(numerator, denominator):

``````# Returns the reciprocal of a fraction with given numerator and denominator.
rec = numerator/denominator ** -1
return rec``````

what's wrong with this, why can't I get the reciprocal? Can anyone find the bug?

`numerator/denominator ** -1` is equivalent to `numerator/(denominator ** -1)`. You can add parentheses around `numerator/denominator` to fix this.