print displays some output to the screen/console.
print is a keyword.
message = "Test"
This prints the word "Test" (without the quotation marks) to the screen or console.
Call and Return
A function call is what makes the function's code execute. In the code below,
square(5) "calls" the
square() function and sends along the integer
5 as a parameter that gets stored in the
number variable as the function executes.
return is used in a function to finish/end the function and send a value back to wherever the function was called from.
return number * number
So, to walk through this short code a little more slowly, here's what happens. The code starts on line 1, which declares a new function. But nothing has told that function to run yet, so nothing happens.
On line 2, this is the inside of the function. But since the function hasn't been called, nothing happens yet either.
On the third line of code (technically, line 4), we have a
print command. But what will print? Well, it will print
square(5). But that's not a string or a variable. It's a function call. So now we have to know what that function does.
So we move back up to line 1, and we bring the
5 with us, because it gets "passed" to the function.
5 in the variable
number and move on to line 2.
Now we see the
return command. But what will the function return? It will return
number * number. That's
5 * 5 because the function call passed
5 in as the one parameter.
Okay, so the function returns
25. Where does it go?
It goes back to line 4 and gets sent to the
print command. Now we know what we'll print, which is the number
So, in short, a call is a request to run/execute a function's code. And a return is a command to return a certain value from a function to wherever the function was called from.