In the ArcGIS Pro 2.0 Python window/command line, an error is produced when using the !=/(not equal to) logic; for example 2!=5 should return a "true", but it returns a syntax error. Also applies to variables, etc., not just integers. It is fine in ArcGIS Pro 1.4.1.
Flip logic, use <> for "not equal to",(deprecated, so does not work in current Python alone but works in ArcGIS Pro), or run Python outside of ArcGIS Pro.