Courseiva
Question 480 of 498
Control Flow, Loops, Lists and LogiceasyMultiple ChoiceObjective-mapped

PCEP Control Flow, Loops, Lists and Logic Practice Question

A programmer needs to iterate over a list of strings and print each string in uppercase. Which loop correctly accomplishes this?

⚠ Common exam trap

Python Institute often tests the distinction between referencing a method (without parentheses) and calling it (with parentheses), leading candidates to pick Option C when they forget that methods must be invoked to execute.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

for i, item in enumerate(mylist): print(item.upper())

Both Option A and Option D correctly iterate over the list and print each string in uppercase. Option A uses enumerate to get each item and calls item.upper() with parentheses, printing the result. Although it introduces an unused index variable i, it still works correctly. Option D uses range(len(mylist)) to access each element by index and prints mylist[i].upper(). Option B fails because it does not print the result; it only reassigns the variable. Option C omits the parentheses on upper(), printing the method object instead of the string.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • for i, item in enumerate(mylist): print(item.upper())

    Why this is correct

    Correct: prints item.upper() for each item, works but has an unused enumeration index.

  • for item in mylist: item = item.upper()

    Why it's wrong here

    Incorrect: assigns uppercase to item but never prints.

  • for item in mylist: print(item.upper)

    Why it's wrong here

    Incorrect: missing parentheses, prints method object, not string.

  • for i in range(len(mylist)): print(mylist[i].upper()) [CORRECT]

    Why this is correct

    Correct: accesses by index and prints uppercase string.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 30, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This PCEP practice question is part of Courseiva's free Python Institute certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCEP exam.