print (n+1) ": x1= ",x1,"f(x)= ",fx
I want it to print what the x1 is and the value of the function at x1 (fx), but I get an invalid syntax on the end of the first quotation. Can someone explain to me what my problem is.
print (n+1) ": x1= ",x1,"f(x)= ",fx
I want it to print what the x1 is and the value of the function at x1 (fx), but I get an invalid syntax on the end of the first quotation. Can someone explain to me what my problem is.
Is this what you are trying to do ( Assuming all are integers):
print("%d: x1= %d f(x)=%d" % ((n+1),x1,fx))
You're missing a comma after n+1
print (n+1), " : x1=",x1,"f(x)=",fx
The problems are
There should be a comma(,) before the 1st quotation.
print (n+1), " : x1=",x1,"f(x)=",fx