Given an array A[] of N elements. The task is to count number of even and odd elements in the array.
Example:
Input:
N = 5
A[] = 1 2 3 4 5
Output:
3 2
Explanation:
There are 3 odd elements (1, 3, 5)
and 2 even elements (2 and 4).
Your Task:
Your task is to complete the function countOddEven() which should print number of odd and number of even elements in a single line seperated by space.
Print a newline at the end of output.
Constraints:
1 <= N <= 10^{6}
1 <= A_{i} <= 10^{6}

Difficulty: EASY
Tags: Data structures
Skill types: Data structures

Starter code:
#User function Template for python3



class Solution:

	def countOddEven(self, arr, n):

		#Code here

Solutions:
class Solution:

	def countOddEven(self, arr, n):
		e = 0
		o = 0
		for i in arr:
			if i % 2 == 0:
				e += 1
			else:
				o += 1
		print(o, e)


class Solution:

	def countOddEven(self, arr, n):
		odd = 0
		even = 0
		for i in range(n):
			if arr[i] % 2 == 0:
				even += 1
			else:
				odd += 1
		print(odd, even)


class Solution:

	def countOddEven(self, arr, n):
		odd_count = 0
		even_count = 0
		for num in arr:
			if num % 2 == 0:
				even_count += 1
			else:
				odd_count += 1
		print(odd_count, even_count)


class Solution:

	def countOddEven(self, arr, n):
		ev = 0
		sol = []
		for i in arr:
			if i % 2 == 0:
				ev += 1
		print(len(arr) - ev, ev)


class Solution:

	def countOddEven(self, arr, n):
		l = [x for x in arr if x % 2 == 0]
		print(n - len(l), len(l))


class Solution:

	def countOddEven(self, arr, n):
		(ev, od) = (0, 0)
		for i in arr:
			if i % 2 == 0:
				ev += 1
			else:
				od += 1
		print(od, ev)


class Solution:

	def countOddEven(self, arr, n):
		countt = 0
		count = 0
		for i in range(n):
			if arr[i] % 2 == 0:
				countt += 1
			else:
				count += 1
		print(count, countt)


class Solution:

	def countOddEven(self, arr, n):
		c1 = 0
		c2 = 0
		for i in arr:
			if i % 2 == 0:
				c1 += 1
			else:
				c2 += 1
		print(c2, end=' ')
		print(c1)


class Solution:

	def countOddEven(self, arr, n):
		a = b = 0
		for i in arr:
			if i % 2 == 0:
				a = a + 1
			else:
				b = b + 1
		print(b, a)


class Solution:

	def countOddEven(self, arr, n):
		c = 0
		k = 0
		for i in range(n):
			if arr[i] % 2 == 0:
				c = c + 1
			else:
				k = k + 1
		print(k, c)


class Solution:

	def countOddEven(self, arr, n):
		(evencount, oddcount) = (0, 0)
		for i in range(len(arr)):
			if arr[i] % 2 == 0:
				evencount += 1
			if arr[i] % 2 != 0:
				oddcount += 1
		print(oddcount, evencount)


class Solution:

	def countOddEven(self, arr, n):
		(oc, ec) = (0, 0)
		for i in range(0, n):
			if arr[i] % 2 == 0:
				ec = ec + 1
			else:
				oc = oc + 1
		print(oc, ec)


class Solution:

	def countOddEven(self, arr, n):
		co = 0
		ce = 0
		for i in arr:
			if i % 2 == 0:
				ce += 1
			else:
				co += 1
		print(co, ce)


class Solution:

	def countOddEven(self, arr, n):
		count1 = 0
		count2 = 0
		for i in range(n):
			if arr[i] % 2 == 0:
				count1 += 1
			else:
				count2 += 1
		print(count2, count1)


class Solution:

	def countOddEven(self, arr, n):
		count_even = 0
		count_odd = 0
		for i in range(n):
			if arr[i] % 2 == 0:
				count_even += 1
				continue
			else:
				count_odd += 1
				continue
		print(count_odd, count_even)


class Solution:

	def countOddEven(self, arr, n):
		O = 0
		E = 0
		for i in range(0, n):
			if arr[i] % 2 == 0:
				E = E + 1
			else:
				O = O + 1
		print(O, E)


class Solution:

	def countOddEven(self, arr, n):
		even = 0
		odd = 0
		for i in arr:
			if i & 1:
				odd += 1
		print(odd, n - odd)


class Solution:

	def countOddEven(self, arr, n):
		x = [i for i in range(n) if arr[i] % 2 != 0]
		y = [i for i in range(n) if arr[i] % 2 == 0]
		print(len(x), len(y))


class Solution:

	def countOddEven(self, arr, n):
		oddcount = 0
		counteven = 0
		for i in arr:
			if i % 2 == 0:
				counteven += 1
			else:
				oddcount += 1
		print(oddcount, end=' ')
		print(counteven)


class Solution:

	def countOddEven(self, arr, n):
		(odd, even) = (0, 0)
		for elem in arr:
			if elem % 2 == 1:
				odd += 1
			else:
				even += 1
		print(str(odd) + ' ' + str(even))


class Solution:

	def countOddEven(self, arr, n):
		codd = 0
		ceven = 0
		for i in range(0, n):
			if arr[i] % 2 != 0:
				codd = codd + 1
			else:
				ceven = ceven + 1
		print(str(codd) + ' ' + str(ceven))


class Solution:

	def countOddEven(self, arr, n):
		v1 = 0
		v2 = 0
		for i in arr:
			if i % 2 == 0:
				v1 += 1
			else:
				v2 += 1
		print(v2, v1)


class Solution:

	def countOddEven(self, arr, n):
		countEven = 0
		for item in arr:
			if item % 2 == 0:
				countEven += 1
		print(n - countEven, countEven)


class Solution:

	def countOddEven(self, arr, n):
		odd = 0
		even = 0
		for I in arr:
			if I % 2 == 0:
				even += 1
			else:
				odd += 1
		return print(odd, even)


class Solution:

	def countOddEven(self, arr, n):
		even_count = 0
		odd_count = 0
		for i in range(n):
			if arr[i] & 1 == 1:
				odd_count += 1
			else:
				even_count += 1
		print(odd_count, even_count)


class Solution:

	def countOddEven(self, arr, n):
		c1 = 0
		c2 = 0
		for i in range(0, n):
			if arr[i] % 2 == 0:
				c1 = c1 + 1
			elif arr[i] % 2 == 1:
				c2 = c2 + 1
		print(c2, c1)


class Solution:

	def countOddEven(self, arr, n):
		odd = []
		even = []
		count1 = 0
		count2 = 0
		for i in arr:
			if i % 2 == 0:
				even.append(i)
				count1 += 1
			else:
				odd.append(i)
				count2 += 1
		print(count2, count1)


class Solution:

	def countOddEven(self, arr, n):
		od = [i for i in range(n) if arr[i] % 2 != 0]
		ev = [i for i in range(n) if arr[i] % 2 == 0]
		print(len(od), len(ev))


class Solution:

	def countOddEven(self, arr, n):
		odd = []
		even = []
		for i in range(n):
			if arr[i] % 2 == 0:
				even.append(arr[i])
			else:
				odd.append(arr[i])
		len_odd = len(odd)
		len_even = len(even)
		print(len_odd, len_even)
		return []