CSC108H5 Lecture Notes - Lecture 3: Memory Address

229 views2 pages
School
Course
897wjface and 39475 others unlocked
CSC108H5 Full Course Notes
12
CSC108H5 Full Course Notes
Verified Note
12 documents

Document Summary

Which of the following contains a function call? (1) type (4. 5) (2) def add_one(x): return x+1 (3) area(2,9) (4) print( hello ) * arguments can have more have one, comma separated. How it"s executed: each argument is an expression. Evaluate these expressions, in order: store references to those evaluated expressions in the corresponding parameters, execute the body of the function. What are the bugs in the following code? def add_one(x): return x+1 x = 2 x = x+add_one(x: no bugs. The code is fine: the function body is not indented, x is used as a parameter and a variable, and it can"t be both, both b and c are bugs. *it is possible to use x in both the parameter and variable. This is because the parameter x is a local x while as the variable x is a different. You can separate the two if they are in two different locations.

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