Answer: Python Puzzler #59

The answer is C. The program prints:

11
What the program prints
Checked by running the program for real.

Why?

len counts every character, including spaces and punctuation. ‘I love code’ has 11.

Trace table

A trace table follows the program step by step. Here’s this one:

countcharacter
1I
2(space)
3l
4o
5v
6e
7(space)
8c
9o
10d
11e

The code again

word = "I love code"
print(len(word))

Try it: change one number in the program and predict the new output before you run it.