Both "if x" and "if x is none" are not the same. If you run the statement "if x:" checks whether x is assigned or not. If you execute the statement "if x is not none", is operator checks whether x is none or not.
If you are still confused, Assign the values x = none, x = , and x = 21 and run the following code. You can observe for x = none, no print statement will be executed, for x = , only second print statement will be executed, and for x = 21, both the print statements will be executed.
print ('if x' )
if x is not None:
print( 'if x is not None')
If you want to become a pro in Python then sign up for this Python Training course by Intellipaat that offers instructor-led training, hands-on assignments, and certification.