Python None Keyword (original) (raw)

Last Updated : 8 Jun, 2026

None is a special keyword that represents the absence of a value. It is commonly used to indicate that a variable has no value assigned or that a function does not return anything explicitly.

Python `

def show(): pass

print(show())

`

**Explanation: show() does not contain a return statement so, Python automatically returns None.

Common Uses of None

None vs Other Empty Values

Although None, False, 0 and "" may all behave as false values in conditions, they represent different things in Python.

Python `

print(None == False) print(None == 0) print(None == "")

`

**Explanation:

Examples

**Example 1: The following example assigns None to a variable. This is often used to indicate that a variable currently has no value.

Python `

x = None

print(x) print(type(x))

`

Output

None <class 'NoneType'>

**Explanation: x = None assigns the special value None to x and type(x) returns NoneType, which is the data type of None.

**Example 2: The following example checks whether a variable contains None using the is operator.

Python `

x = None

if x is None: print("No value assigned") else: print("Value exists")

`

**Explanation:

**Example 3: The following example uses None as a default parameter value when no argument is provided.

Python `

def greet(name=None): if name is None: print("Hello, Guest") else: print("Hello,", name)

greet() greet("Emma")

`

Output

Hello, Guest Hello, Emma

**Explanation: