I'm attempting to code math formulas from square 1 where i use addition to make subtraction, multiplication, division, -etc. etc. But that brung me to exponents, i felt it was simple enough, and i smacked in a repeat and a self multiplying script, and i got what i was looking for, but when i got to things like 2^0, i got 0 because variable=(2)*(2) happening 0 times = 0 and not the usual 1, then negatives started becoming an issue on the scripts complexity, while i'd like to just fix them with more scripting, i want to find the definite formula for this so as to keep things simple.
though what is this formula?
Just start the recursion at 0, eg :
def expo(x, y): """Computes x^y for integers x and y"""
if y==0:
elif y < 0:
"""thank you @Soham Saha for showing how to easily extend this algorithm for possibly negative $y$"""
else: