Lists · Modify the Code

Shape — improve or specify L3 Application Blocks ~3 min

Print only the long names

The program should print only the names with more than 3 letters. Modify it. You may write the new code or describe your changes in words.

names = ["Al", "Beatrice", "Cy", "Dmitri"]
for name in names:
    print(name)
Why this activity was chosen
  • Bloom level: L3 Application: Change existing code to meet a new requirement.
  • Block Model level: Blocks (step 2 of 4): a logical group of statements read as one unit, such as a loop, a conditional or a function.
  • Misconception targeted: shown after you answer, so it does not give the answer away.

Most real programming, and most work with AI output, is changing code that already exists. Students must find the part of the code a new requirement touches and change only that, which is a different skill from writing a solution from scratch.

AI’s role here: AI may suggest which line to look at. It must not supply the changed line.