Question: [ 5 0 points ] Answer the following questions that require you to evaluate expressions or short code fragments. ( a ) Suppose L is

[50 points] Answer the following questions that require you to evaluate expressions or short code fragments.
(a) Suppose L is ["healthy", "join", "verity"]. What does the following expression evaluate to?
[x for x in L for y in x if y in [v,y]
(b) Suppose D is "class": 7,0,1, "thing": 3,1,4,"big": [1,1,9]. What is the value of D after the following code fragment is executed?
"big"][1]= "thing"
"big"][1]
(c) Suppose D is "what": 22, "are":11, "you":14, "doing":5, "next":9, "Saturday":4}. What is the value of D after the following code fragment is executed?
"what"] "are"]
D. update ({"Sunday": 25, "doing":7})
del "you"]
(d) What does this expression evaluate to?
for x in range (2,40) if
for y in range (2,x) if x%y==0 and
for y in range (2,x+2) if (x+2)%y==0
(e) Suppose L is "lettuce", "spinach"],[["parsley"]], "hello", [1,[2],[1,2]]]. What does this expression evaluate to?
sum (L[len(L)-1][2])*L[2].replace("lo","p")
 [50 points] Answer the following questions that require you to evaluate

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!