Not positive where the error is in your current (likely some index issue) but if you simplify it a bit it works fine. Note however it is a O(n^2) solution.
class Solution(object): def moveZeroes(self, nums): i = 0 moved = 0 zero_count = nums.count(0) while moved < zero_count: if nums[i] == 0: nums.pop(i) nums.append(0) moved += 1 continue i += 1 return numsI prefer this, though I almost guarantee your teacher will hate it:
nums.sort(key=lambda x: x == 0)Why work harder when you can work smarter?