PCEP Computer Programming and Python Fundamentals Practice Question
A data scientist has a list: scores = [88, 92, 79, 93, 85]. They want to add 5 bonus points to each score and store the new scores. Which code accomplishes this?
⚠ Common exam trap
The PCEP exam often tests the distinction between modifying a loop variable (which has no effect on the original list) and creating a new list via comprehension, exploiting the common misconception that `for s in scores: s += 5` updates the list.
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
✓
scores = [s + 5 for s in scores]
Uses a list comprehension to create a new list where each element is the original score plus 5. This correctly generates the new scores without modifying the original list, which is the intended behavior.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
scores = [s+5] for s in scores
Why it's wrong here
Syntax error (missing brackets).
- ✓
scores = [s + 5 for s in scores]
Why this is correct
Correct list comprehension.
- ✗
for s in scores: s += 5
Why it's wrong here
Does not modify list elements.
- ✗
scores = scores + 5
Why it's wrong here
Can't add int to list.
Go deeper
Related to this question
About these practice questions
One of 498 original PCEP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
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.