第14111题 单选题
将列表[20, 0, 7, 0, 31]中所有零移动到列表尾,横线处应填入的代码是

现有Python代码如下,补全横线处内容实现需求:

nums = [20, 0, 7, 0, 31]
i, j = 0, 0
while i < len(nums):
    if nums[i] != 0:
        nums[j] = nums[i]
        j += 1
    i += 1
nums[j:] = ______________
print(nums)
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析