This is my code snippet, but it not execute the way that I want.The first if statement executes successfully if the input is a non-negative/character value, but if it is a negative value it ignores the elif statement. What's the issue.I'm using Python 2.6
from math import sqrt
import cmath
y = raw_input("Enter your number:")
if y.isdigit():
x = int(sqrt(float(y)))
print "Answer is", x
elif y < 0:
print "Negative number", cmath.sqrt(y)
else:
print "Not a valid number"
raw_input("Press <enter> to Exit")