QuestionQ262

VerifiedData Collections – Tuples, Dictionaries, Lists, and Strings

After the following code snippet executes, the sum of every element in vals will equal:

Question Image

Explanation

insert(0, 1) adds 1 at the start of the list, and del vals[1] removes the next element, 0. The remaining values are [1, 1, 2], which total 4.

Community Discussion

No comments yet. Be the first to start the discussion!