ENGINEER 1D04 Study Guide - Final Guide: Duplicate Code

31 views2 pages
scarletotter976 and 37168 others unlocked
ENGINEER 1D04 Full Course Notes
4
ENGINEER 1D04 Full Course Notes
Verified Note
4 documents

Document Summary

Example using lists: a = [1, 2, 3] b = [2, 3, 4] a = b a[0] = 10, now you would expect the list a to be [10, 2, 3] but a is actually [10, 3, 4]. These variables are accessible only in the body of the function: actual parameters: when a function is called the variables used as its parameters are actual parameters or arguments, actual parameters and formal parameters are matched up by position, python passes all parameters by value which means that assigning a new value to a formal parameter doesn"t change the variable of the actual parameter, when python sees a function, it will; suspend execution at the point of the function, formal parameters gets assigned values of actual parameters, the body of the function is executed, and control returns to the point after the function, to obtain information from a function or a value, then the return command must be used.