if ([A1] == [B1] and [A2] == [B2]): output = "A AND B IDENTICAL" else: output = "OK"
If you are going to use Python to calculate fields with lots of logic then it is much easier to use an UpdateCursor. The FieldCalculator wraps a cursor around your expression anyway so it is the same thing. I regard the FieldCalculator as a prop to use in ModelBuilder only.
The benefits of using a cursor are many:
with arcpy.da.UpdateCursor(feature_class,['A1',' B1',' A2', 'B2',' C']) as cur: for row in cur: if (row == row and row == row): row = "A AND B IDENTICAL" else: row = "OK" cur.updateRow(row)