CP104 Lecture 23: Cp104 lesson 23
23 views2 pages
hayjayshay and 38575 others unlocked
2
CP104 Full Course Notes
Verified Note
2 documents
Document Summary
Case 1: a function does not return any values: def function_name ([parameter1[, parameter2, ]]): Return: # function definition must appear before the call o # function is not executed until you call it, function_name ([argument1[, argument2, ]]) Case 2: a function returns a value: def function_name ([parameter1[, parameter2, ]]): Return value: # function definition must appear before the call o # function is not executed until you call it, variable = function_name([argument1[,arg2, ]]) Case 3: a function returns more than one value: def function_name ([parameter1[, parameter2, ]]): Return value1, value2: # function definition must appear before the call o # function is not executed until you call it, var1, var2 = function_name ([arg1[, arg2, ]]) Def main ():