Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 3

108 bytes added, 08:22, 31 May 2017
PART 1 - Using Functions
greeting = 'Good Morning ' + name
return greeting
</source>
:# Call the function in your ipython3 shell by issuing the following:<source>
return_text_value()
</source>One major difference between a function '''returning a value''' and simply '''printing a value''' is that '''returned''' values can be caught and stored in variables used in the program (that called the function) for later use. Once the returned value has been stored, it can be printed, manipulated, compared in IF statements, etc. Below will cover how to store a returned value.<br><br>
:#Enter the following function in the ipython3 shell to see returning a variable's value works:<source>
13,420
edits