第40600题 单选题
有一组数据 [20, 0, 7, 0, 31] 存放在nums中,希望将列表中的所有零移动到列表尾,应在横线填入代码是 ( )。
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 }}%
答案解析