CSCI 1105 Lecture Notes - Lecture 25: Venn Diagram, Global Variable
CSCI 1105 verified notes
25/25View all
Document Summary
Summary chapter 5 (10 questions on the exam about this) A function is a named sequence of instructions. Arguments are supplied when functions are called. Return value is the result that the function computes. When declaring a function, provide a name for the function and a variable for each argument. Comments in a function explain the purpose of a function, the meaning of parameters and return value, as well as any special requirements. Parameter variables hold the arguments supplied in the function call. The return statement terminates a function call and yields the function result: you don"t need any return statements in a python function. Complete computations can be reused in functions. Use the process of stepwise refinement to decompose complex tasks into simpler ones. When you discover that you need a function, write a description of the parameter variables and return values. A function may require simpler functions to carry out its work.