Loops
Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.
1) Part 1
ids = [3, -5, 1]
i = 0
while i < len(ids):
ids[i] = ids[-i]
i = i + 1
print(ids)
What value is printed?
2) Part 2
u = 10
v = 9
w = [6, -11, 3]
for i in range(len(w)):
v = v - u*w[i]
print((u, v, i, "w"))
What value is printed?
Back to exercises