danielalubezki (1)

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?

You are viewing a single comment. View All
pyelias (1466)

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

danielalubezki (1)

@pyelias It worked! Thank you so much:)