I need some help with my math homework. I have a number of problems I need to return the derivative for.
They will all be of the form:  
ax^b,  
A and B are both integers, but can be positive or negative.
Note: 
  - if b is 1, then the equation will be ax.  
  - if b is 0, then the equation will be 0.  
Examples:
  3x^3   -> 9x^2  
  3x^2   -> 6x  
  3x     -> 3  
  3      -> 0  
  3x^-1  -> -3x^-2  
  -3x^-2 -> 6x^-3  
If you don't remember how derivatives work, here's a link with some basic rules: https://www.mathsisfun.com/calculus/derivatives-rules.html
def get_derivative(s):
    if "x" not in s:
        return "0"
    elif s[-1] == "x":
        return s[:-1]
    else:
        b, e = [int(p) for p in s.split("x^")]
        return f"{b*e}x{'^'+str(e-1) if e != 2 else ''}"
def get_derivative(s):
    if "x" not in s:
        return "0"
    elif s[-1] == "x":
        return s[:-1]
    else:
        b, e = [int(p) for p in s.split("x^")]
        return f"{b*e}x{'^'+str(e-1) if e != 2 else ''}"