QuestionQ10

VerifiedData Collections – Tuples, Dictionaries, Lists, and Strings

What output is expected from the following code?

Question Image

Explanation

insert(0, 1) adds 1 at the beginning of the list. Deleting index 1 removes the 0, leaving [1, 1, 2]; sum() therefore returns 4.

Community Discussion

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