I have a problem with my code. The language is python. I am trying to use an if statement to execute some code if a variable has a certain value.
op = 5
if(op = 5):
print("op is 5!")
Every time I run this program, it gives me a syntax error. I have tried doing this instead;
op = 5
if op = 5:
print("op is 5!")
But it still gives me the error. I am asking this question because I am doing a calculator project and need this.
ifstatement.:=. Edit: Actually I guess you said statement so you are still correct^points to the exact part of the expression (unfortunately Python doesn't have a super clear diagnostic message which is certainly could in this case).