How come there is the "None" written in the console when I call a function

So I was working on this exercise and printed the function, along with that, the “None was printed” and I don’t know why.

https://www.codecademy.com/paths/data-science/tracks/dscp-python-fundamentals/modules/dscp-python-functions/lessons/intro-to-functions/exercises/write-a-function

None is the absence of a return value. On line 15 you try to print() the result of the function call, but the function does not return anything

4 Likes

When we define a function, it expects a return keyword. Return collects the result of an expression into the function which shows whenever you print the variable in which you have stored the function or just by print which you have done in above program.

only calling a function, like function() will only run the function… if it has print then the print function will run.
if the function has return keyword with an expression, the function will store the value and display when you call it.
if the return is not present or return None is written in the function then it will show none

1 Like