ITP 115 Lecture 10: ITP 115 Lecture 10
Document Summary
# return (what is the output?) def functionname (parameter1, parameter2 = defaultvalue) # input = parameters (and default value) statement1 statement2 statementn return value: 2) call the function. # give the functionname something to put output into (in this case, var ) var = functionname(arg1, arg2) # arg = argument since it"s called a parameter when you define the function, and an argument when you call the function. Remember: strings are immutable; lists are mutable (you can alter their elements) Main() function: often starting point of larger program, python: main() has no special meaning. But it"s programming convention to call starting function main(: all code that used to be aligned left will now be in main() function. Main() will call other functions as needed. Main() function characteristics/uses: takes no arguments; returns no values, functions can be defined in any order as long as a function call to main() is called at the end of the file.