CP104 Lecture 24: Cp104 lesson 24

12 views2 pages
School
Course
hayjayshay and 38575 others unlocked
CP104 Full Course Notes
2
CP104 Full Course Notes
Verified Note
2 documents

Document Summary

Def function_name ([parameter1[, parameter2, ]]): (if no parameters, still need the brackets) o. Statement: statement o, return [value1[, value2, ]] Note: when reading computer notation, the square brackets are used to denote optional items. 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, ]])

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents