Python None Keyword
Python Keywords
Example
Assign the value None to a variable:
x = None
print[x]
Try it Yourself »
print[x]
Definition and Usage
The None keyword is used to define a null value, or no value at all.
None is not the same as 0, False, or an empty string. None is a data type of its own [NoneType] and only None can be None.
More Examples
Example
If you do a boolean if test, what will happen? Is None True or False:
x = None
if x:
print["Do you think None is True?"]
elif x is False:
print ["Do you think None is False?"]
else:
print["None is not True, or False, None is just None..."]
Try it Yourself »
if x:
print["Do you think None is True?"]
elif x is False:
print ["Do you think None is False?"]
else:
print["None is not True, or False, None is just None..."]
Python Keywords