As mentioned in my comment run the following in order in a Python shell or IDE:
Counter([n % 2 for n in nums])
Counter([n % 2 for n in nums]).most_common()
Counter([n % 2 for n in nums]).most_common()[0]
Counter([n % 2 for n in nums]).most_common()[0][0]
as for the rest, you need to find out what it is supposed to be doing.