题目
题目
单项选择题

Question4 After running the code below, what is the value of variable nums? nums = [1, 2, 3] nums.insert(1, 5) nums.append(4) nums.append(5) print(nums) Select one alternative: [1, 2, 3, 5, 4, 5] [1, 5, 2, 3, 4, 5] [1, 2, 5, 3, 4] IndexError ResetMaximum marks: 2 Flag question undefined

选项
A.[1, 2, 3, 5, 4, 5]
B.[1, 5, 2, 3, 4, 5]
C.[1, 2, 5, 3, 4]
D.IndexError
查看解析

查看解析

标准答案
Please login to view
思路分析
We start with the given code and track how the list changes step by step. Option analysis will consider what each listed final state would imply. Option A: "[1, 2, 3, 5, 4, 5]". This would correspond to inserting 5 at index 3 (which would place 5 after 3), or performing a sequence that somehow leaves the original elements in their initial order with 5 inserted later in an incorrect position. However, after nums.in......Login to view full explanation

登录即可查看完整答案

我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!