Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 3

33 bytes added, 08:18, 31 May 2017
PART 1 - Using Functions
hello()
</source>You should notice that the function just does the same thing over-and-over no matter how many times your call the function by name. By the way, that is OK. On the other hand, you may want to create and use a function to do something, like perform error checking or some other task that returns a value to the '''main''' program for further processing. For example, a '''true''' or '''false''' value if the error checking function that was called was detected no errors or detected an error. But let's stick to some simple examples first, before tackling more complex use of functions.<br><br>
:#Let's create a function that '''returns''' some data after the function is called. This function does not print out any text, : instead; it creates new variables and at the end returns the valueof one of the variables.<source>
def return_text_value():
name = 'Terry'
13,420
edits