Python Easy and Straightforward Solution with Explanation
We iterate through nums and check if the number is even using the mod operator. The mod operater returns the remainder of a division expression. For example, 4%
We iterate through `nums` and check if the number is even using the mod operator. The mod operater returns the remainder of a division expression. For example, `4%2` would return `0` because `4/2 = 2 R0` (no remainder). If the number is even, insert it at the beginning of the result list. If it is odd (else), append it at the end of the result list.\n\n```\nclass Solution(object):\n    def sortArrayByParity(self, nums):\n        """\n        :type nums: List[int]\n        :rtype: List[int]\n        """\n        res = []\n        for i in nums:\n            if i%2 == 0:\n                res.insert(0, i)\n            else:\n                res.append(i)\n        return res\n```\n\n**If you liked this, please upvote to support me!**
['Python']