I am making a code for determining the derivative of a sine function, but I have two problems. And before you read them, please be aware that this is not my entire code (it's just the beginning. I didn't want to copy the whole code down because it is over 100 lines long), and it is nowhere near completed.
-
My code won't run. It always says syntax error and highlights the colon in the 'if' statement, which is weird because that part seems fine to me.
-
I don't want the spaces in between the calculated math values and printed strings when I print the solution. I added commas in between them, but I don'y know how to get rid of the spaces that go there.
Thank you so much! God Bless whoever helps me.
print("y=C(sin(Ax))^p")
C= float(input("What is the coefficient(C; c!=0)? "))
A= float(input("What is (A; A!=0)? "))
P= float(input("What is the function rasied to the power of (P; P!=0)?")
if P==1:
if A==1:
if C==1:
print("dy/dx=cos(x)")
elif C>0:
print("dy/dx=",C,"cos(x)")
elif A>1:
if C==1:
print("dy/dx=",A,"cos(",A,"x)")
elif C>1:
print("dy/dx=",A*C,"cos(",A,"x)")
elif C<1:
print("dy/dx=",A*C,"cos(",A,"x)")
elif A<1:
if C==1:
print("dy/dx=",A,"cos(",A*-1,"x)")
elif C>1:
print("dy/dx=",A*C,"cos(",A*-1,"x)")
elif C<1:
print("dy/dx=",A*C,"cos(",A*-1,"x)")
Aucun commentaire:
Enregistrer un commentaire