the return statement
I'm trying to understand the return statement and its role in a function definition. For example, I wrote this: def square(a): b=1 c=a*a+b print(a, "says hello to", c) return(c) square(5) The output was: 5 says hello to 26 So far so good. Then I noticed that I by mistake wrote return(b) instead of return(c) but that didn't change the output. So I wrote return(a) instead and it didn't change the output. Only when I put a letter that hasn't been defined did I change the output (to an error message). Finally I removed the return statement and only wrote following: def square(a): b=1 c=a*a+b print(a, "says hello to", c) square(5) Again the output was:5 says hello to 26 The output is the same regardless of the return statement being in the code or not. So I don't understand the purpose of writing the return statement. What does it contribute to the output?