I'm trying to fix a problem like if a number is odd print smth. if even print smth. else. My Python code is as follows ;
N = int(raw_input().strip())
if num % 2 == 0 and num != 0:
print 'Not Odd'
elif num == 0:
print 'Case Zero'
You have a
' within the string enclosed by
print 'Zero can\'t be odd or even!'
As I see, your indent is bad as well. Pleas align the elif and else below the if.
You also have a not syntactical problem. "Not even" and "Odd" are the two possibilities for you which is bad.
I've corrected these errors for you:
def dec(num): if num % 2 == 0 and num != 0: print 'Even' elif num == 0: print 'Zero can\'t be odd or even!' else: print 'Odd' for N in range(5): dec(N)
One more thing is that you should think about the question about 0 wheter you really want to say that it's not even. Ask your math teacher about this.