If you want to return a null function in Python then use the None keyword in the returns statement.
Example Python return null (None).
def NoOne(x):
print(x)
return None
print(NoOne("Function Called"))
Output:

Note: There is no such term as “return null” in Python. Every function returns some value (unless it raises an exception). If no explicit return statement is used, Python treats it as returning None
To literally return ‘nothing’ use pass
, which basically returns the value None if put in a function(Functions must return a value, so why not ‘nothing’). You can do this explicitly and return None
yourself though.
if x>1:
return(x)
else:
pass
OR
if x>1:
return(x)
else:
return None
Do comment if you have any doubts and suggestions on this Python return topic.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
Windows 10
Python 3.10.1
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.