def distance_from_zero(a): if isinstance(a, float) or isinstance(a, int): return abs(a) else: return "Nope"
This fails with this: “Your function seems to fail on input True when it returned ‘1’ instead of ‘Nope’” I get that this is because
bool is a subclass of
int but how else would I solve this problem?
The provided solution (when I click “Get code”) does not work either, it has the same error.