Unlike ‘pass’, ‘none‘ is a keyword in python and not a statement. You must have observed specially CS and IP students – in programming we use null to represent absence of a value.

What exactly does keyword ‘None’ do in python?

In python ‘None’ keyword is implemented as a object and represents the absence of a value same as null. It is a kind of data type of the class ‘NoneType’

In Python "None" Type or "None" keyword is used to denote absence of a value.
None is an object implemented using a class NoneType

Note – about None

  • You can assign ‘None‘ to any variable type or an object.
  • You cannot create another object of class ‘NoneType
  • None‘ and ‘False‘ in Python are not same.
  • None‘ is also not same a value 0 (zero).
  • Truthiness of ‘None‘ is ‘False‘. This means if ‘None‘ is assigned to any variable and if you compare that variable or ‘None‘ itself to another variable (that variable should not have a None value) it will always returns ‘False‘.
  • If you will compare ‘None‘ with ‘None‘ or any two variables assigned the value ‘None‘ – will return ‘True‘.

Example code – ‘None’ is Python

if x is None:
    print("X is None")
    print("X is not None"

#Example x=None y=None # Both the statements below will print True as an output print(x==y)                   print(None==None)     

You can also check what type of object is ‘None


it will give the output:

<class ‘NoneType’>

Checkout what will be the output of the following lines of code (you can try these lines of code in interactive mode of python only and justify your answer on the basis of explanation given above:



Pawan Arora AdministratorKeymaster
Founder , Edukers
Teaching, Coding and Sharing is his passion. A true mentor and motivator. C/C++, Python, Java, Web Technologies (html5 / CSS/ Javascript/ JQuery,Bootstrap, nodeJS ,PHP etc.) and a WordPress enthusiast with more than two decades of experience.
follow me