NONE IN PYTHON

What is None?

The None object is used to represent the absence of a value. It is similar to null in other programming languages.

Like others “empty” values , such as 0, [] and the empty string, it is False when converted to a Boolean variable.

When entered at the Python console, it is displayed as the empty string.

EXAMPLE:

>>> None == None

Output : True

>>> None

>>> print(None)

Output: None

The None object is returned by any function that doesn’t explicitly return anything else.

EXAMPLE:

def some_fun():

print(“Hi”)

var=some_func()

print(var)

Output: Hi!

None

Leave a comment

Design a site like this with WordPress.com
Get started