ITP 115 Lecture 10: ITP 115 Lecture 10

60 views4 pages

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.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents