Sobes.tech
Junior — Middle

What value will the function in Python return if it lacks a return statement?

sobes.tech AI

Answer from AI

If a Python function does not have a return statement, it returns the value None by default.

Example:

def foo():
    x = 10  # no return

result = foo()
print(result)  # Will output: None

This means that the function executes the code but does not return an explicit value.