Thanks all. Declaring the variable and adding white space fixed it. >>> import math >>> x = 4 >>> if x > 0: ... print "x is positive" ... x is positive >>> if x%2 == 0: ... print x, "is even" ... else: ... print x, "is odd" ... 4 is even >>>