Why my function results in infinite loop? I want to return the value of the exponential base (2**3 which should return 8)?
def iterPower(base, exp):
i = 0
answer = 0
while exp >= 0:
if i!= exp:
answer = base * (base * i)
i += 1
else:
answer = base * (base * i)
return answer
iterPower(2,3)