This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: code is entered into Python ? (i) x = ["a","b","c"] y = [1,2,3,4,x] z = y[4] (ii) y = ["a","b","c"] z = [1,2,3] http://www.cs.ucsd.edu/classes/fa06/cse130/shw/shw6.html (1 of 2) [2/13/2008 5:25:32 PM] Suggested Homework #6 def f(x): x = z f(y) (iii) x = [1,2,3] z = 10 def f(y): x[0] = y x[1] = x[0] f1 = f f1(z) w = x[1] Problem 3: What is the value of z at the end of the following program: x=[0] def f(y): def g(): x[0] = x[0] + 1 y[0] = y[0] + 1 return(y[0],x[0]) return g g1 = f([10]) g2 = f([100]) z = [g1(),g1(),g1(),g1(),g2(),g2(),g2(),g2()] http://www.cs.ucsd.edu/classes/fa06/cse130/shw/shw6.html (2 of 2) [2/13/2008 5:25:32 PM]...
View
Full
Document
 Fall '06
 Jhala

Click to edit the document details