def aa(base,exponent): if base==0 and exponent<=0: return False ret=bb(base,abs(exponent)) if exponent<0: return 1/ret else: return ret def bb(base,exponent): if exponent==0: return 1 if exponent==1: return base ret=bb(base,exponent>>1) ret *=ret if exponent &1==1: ret *=base return ret print(aa(3,5))