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 (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
hovnival
1 month, 1 week ago
Selected Answer: D
# Question 70 data = [1, 5, 10, 19, 55, 30, 55, 99] data.pop(5) data.remove(19) data.remove(55) data.remove(55) print(data)
upvoted 1 times
...
sandy589
3 months, 2 weeks 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
3 months, 3 weeks ago
D would remove 5, which needs to remain, and would not remove 30?
upvoted 1 times
...
christostz03
5 months, 2 weeks 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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago