错误示范: class Solution: def removeElement(self, nums, val: int) -> int: for i, num in enumerate(nums): print('i=', i, ', num=', num, ', nums=', nums) if num == val: nums.remove(val) return len(nums) s = Solution() s.removeElement([2, 0,1,2,2,3,0,4,2],…