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.
Link to relevant readings:
-- Iteration (all of section 5)
1) Part 1
ids = [3, -5, 1]
i = 0
while i < len(ids):
ids[i] = ids[-i]
i += 1
print(ids)
What value is printed?
2) Part 2
word = "summer"
vowels = "aeiou"
out = ""
for char in word:
if char in vowels:
char = char.upper()
out += char
print(word+out)
What value is printed?
Back to exercises