Built my first script and its function is to solve simple derivative questions. How can I improve this code? This is my first time posting.
#This is Simple Derivative Solver
def derivative():
print("This program will give you the first derivative.")
input("Press ENTER to continue...")
cf=int(input("Enter the coefficient of the term..."))
exp=int(input("Enter the exponent of the term..."))
if exp==1 and cf==1:
print("The answer is", 1)
elif exp<0 and cf<0:
print("The answer is:", abs(exp*cf), "x^", (exp-1))
elif exp>0:
print("The answer is:", exp*cf, "x^", (exp-1))
elif exp==0:
print("The answer is:", 0)
elif exp<0:
print("The answer is:", abs(exp*cf), "x^", (exp-1))
elif cf==0:
print("The answer is:", 0)
elif cf<0:
print("THe answer is:", cf*exp, "x^", (exp-1))
derivative()