Computer Science Homework Help

CSI 31 Bronx Community College What Does the Following Code Print Questions

 

. What does the following code print? Explain and justify your answer.

D = {6:5, 9:2, 3:7, 2:9} k=0

t=0

while k < 9:

if k in D:

t = t + D[k]

k=k+3

print(“t = “, t)

print(“k = “, k)

2. What does the following code print? Explain and justify your answer.

def csi(x):

if x <= 0:

return 1

else:

return 10 + csi(x – 1)

print(csi(-5))

print(csi(3))

print(csi(50))