# Task
Given array of integers `sequence` and some integer `fixedElement`, output the number of `even` values in sequence before the first occurrence of `fixedElement` or `-1` if and only if `fixedElement` is not contained in sequence.



# Input/Output


`[input]` integer array `sequence`

A non-empty array of positive integers.

`4 ≤ sequence.length ≤ 100`

`1 ≤ sequence[i] ≤ 9`

`[input]` integer `fixedElement`

An positive integer

`1 ≤ fixedElement ≤ 9`

`[output]` an integer


# Example

For `sequence = [1, 4, 2, 6, 3, 1] and fixedElement = 6`, the output should be `2`.

There are `2` even numbers before `6`: `4 and 2`

For `sequence = [2, 2, 2, 1] and fixedElement = 3`, the output should be `-1`.

There is no `3` appears in `sequence`. So returns `-1`.

For `sequence = [1, 3, 4, 3] and fixedElement = 3`, the output should be `0`.

`3` appears in `sequence`, but there is no even number before `3`.

Difficulty: EASY
Starter code: def even_numbers_before_fixed(sequence, fixed_element):
	

Solutions:
def even_numbers_before_fixed(s, f):
	return len([x for x in s[:s.index(f)] if x % 2 == 0]) if f in s else -1


def even_numbers_before_fixed(sequence, fixed_element):
	ans = 0
	for s in sequence:
		if s == fixed_element:
			return ans
		ans += s % 2 == 0
	return -1


def even_numbers_before_fixed(sequence, fixed_element):
	return len(list(filter(lambda x: x % 2 == 0, sequence[:sequence.index(fixed_element)]))) if fixed_element in sequence else -1


def even_numbers_before_fixed(sequence, fixed_element):
	if fixed_element in sequence:
		i = sequence.index(fixed_element)
		return sum((1 for n in sequence[:i] if n % 2 == 0))
	else:
		return -1


from itertools import islice

def even_numbers_before_fixed(sequence, fixed_element):
	try:
		i = sequence.index(fixed_element)
	except ValueError:
		return -1
	return sum((x % 2 == 0 for x in islice(sequence, i)))


def even_numbers_before_fixed(sequence, fixed_element):
	try:
		return sum((elem % 2 == 0 for elem in sequence[:sequence.index(fixed_element)]))
	except ValueError:
		return -1


def even_numbers_before_fixed(a, n):
	return sum((i % 2 == 0 for i in a[:a.index(n)])) if n in a else -1


def even_numbers_before_fixed(s, fe):
	if fe in s:
		idx = s.index(fe)
		return sum([(e + 1) % 2 for e in s[:idx]])
	else:
		return -1


def even_numbers_before_fixed(seq, e):
	return sum((1 - n % 2 for n in seq[:seq.index(e)])) if e in seq else -1


def even_numbers_before_fixed(S, p):
	return sum((not e % 2 for e in S[:S.index(p)])) if p in S else -1