PCEP Control Flow, Loops, Lists and Logic Practice Question
Which two of the following are valid ways to create a list with elements 1, 2, 3? (Select two.)
⚠ Common exam trap
Python Institute often tests the distinction between list literals (square brackets) and tuple literals (parentheses), and the requirement for commas as separators, to catch candidates who confuse syntax from other languages or misuse punctuation.
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
✓
list = list(range(1, 4))
`list(range(1, 4))` creates a list from the range object that generates numbers 1, 2, and 3 (the `range` function stops before the stop value 4). This is a common Python idiom for converting a range into a list.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
list = list(range(1, 4))
Why this is correct
Valid: range creates sequence, list() converts to list.
- ✓
list = [1, 2, 3]
Why this is correct
Valid list literal.
- ✗
list = [1, 2, 3]]
Why it's wrong here
Extra closing bracket causes SyntaxError.
- ✗
list = (1, 2, 3)
Why it's wrong here
Creates a tuple, not a list.
- ✗
list = [1; 2; 3]
Why it's wrong here
Invalid syntax; semicolons not allowed in list literals.
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.