Why does printing the function print out the value and datatype?

This is from Introduction to Python, Functions: Intermediate - Step 8/12

def print_constant():
    x = 3.14
    print(x)
    
print(print_constant())

OUTPUT:

3.14
None

When you execute the code print(print_constant()), the “print_constant()” first executes and prints the value of “x” as defined in this function. Since this function does not return anything, printing the value of the function print_constant() results in NONE to printed.

1 Like