Skip to content
Related Articles

Related Articles

Python None Keyword
  • Difficulty Level : Basic
  • Last Updated : 12 Nov, 2020

None is used to define a null value. It is not the same as an empty string, False, or a zero. It is a data type of the class NoneType object. 

Assigning a value of None to a variable is one way to reset it to its original, empty state.

Example 1:


# we will check the type of None
<class 'NoneType'>

Example 2:


# declaring a variable as None
var = None
# checking it's value
if var is None:
    print("var has a value of None")
    print("var has a value")
var has a value of None

Note: If a function does not return anything, it returns None in python.

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :