Given a linked list of size N, your task is to complete the function isLengthEvenOrOdd() which contains head of the linked list and check whether the length of linked list is even or odd.
Input:
The input line contains T, denoting the number of testcases. Each testcase contains two lines. the first line contains N(size of the linked list). the second line contains N elements of the linked list separated by space.
Output:
For each testcase in new line, print "even"(without quotes) if the length is even else "odd"(without quotes) if the length is odd.
User Task:
Since this is a functional problem you don't have to worry about input, you just have to  complete the function isLengthEvenOrOdd() which takes head of the linked list as input parameter and returns 0 if the length of the linked list is even otherwise returns 1.
Constraints:
1 <= T <= 100
1 <= N <= 10^{3}
1 <= A[i] <= 10^{3}
Example:
Input:
2
3
9 4 3
6
12 52 10 47 95 0
Output:
Odd
Even
Explanation:
Testcase 1: The length of linked list is 3 which is odd.
Testcase 2: The length of linked list is 6 which is even.

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

Starter code:
# your task is to complete this function

# function should return false/0 if length is even

# else return true/1

def isLengthEvenOrOdd(head):

    # Code here

Solutions:
def isLengthEvenOrOdd(head):
	if head is None:
		return None
	curr = head
	node_count = 0
	while curr:
		node_count += 1
		curr = curr.next
	if node_count % 2 == 0:
		return 0
	else:
		return 1


def isLengthEvenOrOdd(head):
	trav = head
	length = 0
	while trav:
		length += 1
		trav = trav.next
	if length % 2 == 0:
		return False
	else:
		return True


def isLengthEvenOrOdd(head):
	l = 0
	while head != None and head.next != None:
		head = head.next.next
		l += 2
	if head != None:
		l += 1
	if l % 2 == 0:
		return 0
	return 1


def isLengthEvenOrOdd(head):
	count = 0
	while head is not None:
		count += 1
		head = head.next
	if count % 2 == 0:
		return 0
	else:
		return 1


def isLengthEvenOrOdd(head):
	num = 1
	current_node = head
	while current_node.next is not None:
		current_node = current_node.next
		num += 1
	return num % 2


def isLengthEvenOrOdd(head):
	c = 0
	ptr = head
	while ptr != None:
		c += 1
		ptr = ptr.next
	if c % 2 == 0:
		return 0
	else:
		return 1


def isLengthEvenOrOdd(head):
	count = 0
	while head:
		count += 1
		head = head.next
	if count % 2 != 0:
		return 1
	return 0


def isLengthEvenOrOdd(head):
	c = 1
	while head.next:
		c += 1
		head = head.next
	return c % 2


def isLengthEvenOrOdd(head):
	N = 0
	temp = head
	while temp != None:
		temp = temp.next
		N = N + 1
	if N % 2 == 0:
		return False
	else:
		return True


def isLengthEvenOrOdd(head):
	temp = head
	count = 0
	while temp != None:
		count += 1
		temp = temp.next
	if count % 2 == 0:
		return False
	return True


def isLengthEvenOrOdd(head):
	length = 0
	dummy = head
	while dummy:
		dummy = dummy.next
		length += 1
	if length % 2 == 0:
		return 0
	else:
		return 1


def isLengthEvenOrOdd(head):
	c = 0
	while head:
		c += 1
		head = head.next
	if c == 0 or c % 2 == 0:
		return 0
	return 1


def isLengthEvenOrOdd(head):
	length = 0
	while head.next:
		head = head.next
		length += 1
	return length % 2 == 0


def isLengthEvenOrOdd(head):
	temp = head
	count = 1
	while temp != None:
		count = count + 1
		temp = temp.next
	if count % 2 == 0:
		return 1
	else:
		return 0


def isLengthEvenOrOdd(head):
	le = 0
	temp = head
	while temp:
		temp = temp.next
		le += 1
	return 0 if le % 2 == 0 else 1


def isLengthEvenOrOdd(head):
	counter = 0
	while head:
		counter += 1
		head = head.next
	if counter % 2 == 0:
		return 0
	else:
		return 1


def isLengthEvenOrOdd(head):
	count = 0
	while head:
		count += 1
		head = head.next
	return False if count % 2 == 0 else True


def isLengthEvenOrOdd(head):
	n = 0
	current = head
	while current.next != None:
		current = current.next
		n = n + 1
	return n % 2 == 0 if 'Even' else 'Odd'


def isLengthEvenOrOdd(head):
	if head is None:
		return 0
	i = 0
	node = head
	while node:
		node = node.next
		i += 1
	return i % 2


def isLengthEvenOrOdd(head):
	cur = head
	count = 0
	while cur != None:
		count += 1
		cur = cur.next
	x = count
	if x % 2 == 0:
		return 0
	else:
		return 1


def isLengthEvenOrOdd(head):
	count = 0
	curr = head
	while curr:
		count += 1
		curr = curr.next
	return count % 2 != 0


def isLengthEvenOrOdd(head):
	n = 0
	while head != None:
		n += 1
		head = head.next
	return 1 if n % 2 else 0


def isLengthEvenOrOdd(head):
	if not head:
		return ''
	n = 0
	cur = head
	while cur:
		n += 1
		cur = cur.next
	if n % 2 == 0:
		return 0
	else:
		return 1


def isLengthEvenOrOdd(head):
	curr = head
	count = 0
	while curr:
		count += 1
		curr = curr.next
	if count % 2 == 0:
		return 0
	else:
		return 1


def isLengthEvenOrOdd(head):
	length = 1
	while True:
		head = checkForNextElement(head)
		if head != None:
			length += 1
		else:
			if length % 2 == 0:
				return False
			return True
			break

def checkForNextElement(head):
	try:
		return head.next
	except:
		return None


def isLengthEvenOrOdd(head):
	curr = head
	c = 0
	while curr != None:
		c += 1
		curr = curr.next
	if c % 2 == 0:
		return 0
	return 1


def isLengthEvenOrOdd(head):
	curr = head
	length = 0
	while curr is not None:
		length += 1
		curr = curr.next
	if length % 2 == 0:
		return 0
	else:
		return 1


def isLengthEvenOrOdd(head):
	count = 0
	current = head
	while current:
		count += 1
		current = current.next
	return count % 2


def isLengthEvenOrOdd(head):
	length = 1
	next_node = head.next
	if not next_node:
		return 1
	while next_node:
		length += 1
		next_node = next_node.next
	if length % 2 == 0:
		return 0
	else:
		return 1


def isLengthEvenOrOdd(head):
	c = 0
	while head is not None:
		c += 1
		head = head.next
	return c & 1


def isLengthEvenOrOdd(head):
	l = []
	while head:
		l.append(head)
		head = head.next
	if len(l) % 2 == 0:
		return False
	else:
		return True


def isLengthEvenOrOdd(head):
	last = head
	count = 0
	while last and last.next:
		count += 1
		last = last.next
	if count % 2 == 0:
		return 1
	else:
		return 0


def isLengthEvenOrOdd(head):
	if head == None:
		return 0
	cnt = 0
	while head != None:
		cnt += 1
		head = head.next
	return cnt % 2


def isLengthEvenOrOdd(h):
	c = 0
	n = h
	while n:
		n = n.next
		c += 1
	return bool(c % 2 == 1)


def isLengthEvenOrOdd(head):
	number_of_nodes = 0
	current_node = head
	while current_node:
		number_of_nodes += 1
		current_node = current_node.next
	if number_of_nodes % 2 == 0:
		return 0
	return 1


def isLengthEvenOrOdd(head):
	count = 0
	while head is not None:
		count += 1
		head = head.next
	if count % 2 == 0:
		return False
	return True


def isLengthEvenOrOdd(head):
	c = 0
	while head != None:
		c += 1
		head = head.next
	return c % 2


def isLengthEvenOrOdd(head):
	temp = head
	c = 0
	while temp is not None:
		c += 1
		temp = temp.next
	if c % 2 == 0:
		return False
	else:
		return True


def isLengthEvenOrOdd(head):
	c = head
	k = 0
	while c:
		k += 1
		c = c.next
	if k % 2 != 0:
		return 1
	return 0


def isLengthEvenOrOdd(head):
	length = 0
	current_node = head
	while current_node != None:
		length = length + 1
		current_node = current_node.next
	if length % 2 == 0:
		return 0
	else:
		return 1


def isLengthEvenOrOdd(head):
	count = 0
	curr = head
	while curr is not None:
		count += 1
		curr = curr.next
	return count % 2 != 0


def isLengthEvenOrOdd(head):
	if head is None:
		return 0
	length = 0
	while head:
		length += 1
		head = head.next
	return length % 2


def isLengthEvenOrOdd(head):
	if not head:
		return False
	cnt = 0
	while head:
		head = head.next
		cnt += 1
	if cnt % 2 == 0:
		return False
	else:
		return True


def isLengthEvenOrOdd(head):
	t = head
	i = 0
	while t:
		i += 1
		t = t.next
	return i % 2