I am confused about the error I am getting.
My code is as below:
result = getString(argument_x)
print result # it returns "PASS"
if result ="PASS"
When I try to launch it, it shows an error for the last line:
SyntaxError: invalid syntax
Comparison for equality is done using the == operator (you're using a single = which is for assignments only). Also, you're missing a colon:
if result == "PASS":
Many Python constructs, like if, while, and for, require a terminating colon :, and the lines following must be indented all at the same level.
The indent level is not as important as all statements associated with the conditional must be indented at the same level.
In your case, you were using an if statement:
result = getString(argument_x)
print result # it returns "PASS"
if result == "PASS":
print("Result equals pass")
#Add any other statements here to be executed as a result
#of result == "PASS"
SyntaxError. Perhaps also because you're mixing Python 2 and Python 3 syntax (although that's not the cause of the error).if “year” == 2019: genre = 33 is still failing for me :(You missed the colon operator after the if statement.
result = getString(argument_x)
print result # it returns "PASS"
if result == "PASS":
print 'something'