The code below suits you.
The try/except function is there so you can handle any exception that comes up from the user input (For example: if the user instead of providing a numeric values writes "hello" in the user input prompt the program without the try/except will break with an unhandled exception)
try:
x = input("Enter the first number:")
x = int(x)
if 1 <= x <= 9: # this checks if the input is in between 1 and 9
pass # here you can add an action that you want to happen when the if clause is true
else:
print("This is not a valid number")
except ValueError:
print("You have not entered a valid value - 0 has been stored instead")
x = 0
del x
is not needed, as you can just reassign the value of 0 to x after the exception occurs.