QuestionQ278

VerifiedControl Flow – Conditional Blocks and Loops

What is printed by the following code snippet?

Question Image

Explanation

Python’s list.insert(-1, value) places value just before the last element. The loop inserts 1 twice, resulting in [1, 1, 1, 2].

Community Discussion

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