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.
numerator/denominator ** -1
numerator/(denominator ** -1)
numerator/denominator
@pyelias It worked! Thank you so much:)
def reciprocal(numerator, denominator):
what's wrong with this, why can't I get the reciprocal? Can anyone find the bug?
numerator/denominator ** -1
is equivalent tonumerator/(denominator ** -1)
. You can add parentheses aroundnumerator/denominator
to fix this.@pyelias It worked! Thank you so much:)