Python None Keyword

Example

Assign None to a variable:

x = None
print(x)

Run Instance

Definition and Usage

The None keyword is used to define a null value or no value at all.

None is different from 0, False, or an empty string. None is its own data type (NoneType), and only None can be None.

More Examples

Example

What will happen if you perform a boolean if test? Is None True or False:

x = None
if x:
  print("Do you think None is True")
else:
  print("None is not True...")

Run Instance