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]
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.
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.
sandy589
1 month agos_tzoref
1 month, 1 week agochristostz03
3 months ago