Skip to main content

Module 1 · after

Computational thinking & Python

The same 6 questions you saw before the module. No running the code: predict, then compare with your first score.

1. What does this print?
word = 'loss'
n = 9 / 3
print(word.upper() + '!', n)
2. What does this print?
names = ['emma', 'zoe', 'olivia', 'liam', 'ava']
picked = []
for name in names:
    if len(name) >= 4:
        picked.append(name)
print(picked)
3. What does this print?
n = 1
steps = 0
while n < 50:
    n = n * 3
    steps += 1
print(steps, n)
4. What does this print?
lines = ['zoe\n', '   \n', ' max\n', '\n', 'ivy']
docs = [line.strip() for line in lines if line.strip()]
print(len(docs), docs[1])
5. count_vowels(word) counts the vowels with a loop, but its last line is print(n) instead of return n. What happens when you run total = count_vowels('ava') + 1?
6. You want to answer "how many names have more than 6 letters?". Which plan breaks the job into the right small steps?

Your answers are saved with a random id, not your name, so we can see which lessons work. Privacy