Print Statement: As you saw on the previous page the print statement converted the number i into a string and printed it to the command line. This is more or less the equivalent of "say" in Snap!. Print statements allow a programmer to print values and variables at a chosen location in the code.
|
|
Return: If print is Python's version of "say", then return is Python's version of "report". return should be used when you want to end a function and report a value.
|
|
If you're testing a function in Python like above, the interpreter will often print the return value so you can see what it was.