I have a piece of code for data validating user input to ensure only numbers greater than zero are taken, as below:
while True:
x = raw_input["Please enter a number greater than zero."]
try:
x = int[x]
num = True
except ValueError:
print "Sorry, you entered an invalid input. Please ensure you enter only numbers greater than zero."
if x > 0:
if num == True:
break
elif x