Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam PCEP-30-02 All Questions

View all questions & answers for the PCEP-30-02 exam

Exam PCEP-30-02 topic 1 question 70 discussion

Actual exam question from Python Institute's PCEP-30-02
Question #: 70
Topic #: 1
[All PCEP-30-02 Questions]

Consider the following list.
data = [1, 5, 10, 19, 55, 30, 55, 99]
Which of the code snippets below would produce a new list like the following?
[1, 5, 10, 99]

  • A.
  • B.
  • C. None of the above.
  • D.
  • E.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
sandy589
1 month ago
Selected Answer: D
D is the correct answer, below is the explanation: data.pop(5) removes the element at index 5 (which is 30), leaving [1, 5, 10, 19, 55, 55, 99]. data.remove(19) removes the first occurrence of 19, leaving [1, 5, 10, 55, 55, 99]. data.remove(55) removes the first occurrence of 55, leaving [1, 5, 10, 55, 99]. data.remove(55) removes the second occurrence of 55, leaving [1, 5, 10, 99], which matches the target list.
upvoted 2 times
...
s_tzoref
1 month, 1 week ago
D would remove 5, which needs to remain, and would not remove 30?
upvoted 1 times
...
christostz03
3 months ago
d is the correct answer
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...