We'll create a function that takes in two parameters:

* a sequence (length and types of items are irrelevant)
* a function (value, index) that will be called on members of the sequence and their index. The function will return either true or false.

Your function will iterate through the members of the sequence in order until the provided function returns true; at which point your function will return that item's **index**. 

If the function given returns false for all members of the sequence, your function should return -1.

```python
true_if_even = lambda value, index: value % 2 == 0
find_in_array([1,3,5,6,7], true_if_even) # --> 3
```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def find_in_array(seq, predicate):
	

Solutions:
def find_in_array(seq, predicate):
	for (index, value) in enumerate(seq):
		if predicate(value, index):
			return index
	return -1


def find_in_array(seq, fn):
	return next((i for (i, j) in enumerate(seq) if fn(j, i)), -1)


def find_in_array(seq, predicate):
	return next((i for (i, v) in enumerate(seq) if predicate(v, i)), -1)


find_in_array = lambda seq, predicate: (lambda ret: -1 if not ret else ret[0])([i for (i, e) in enumerate(seq) if predicate(e, i)])


def find_in_array(seq, pred):
	return next((ix for (ix, s) in enumerate(seq) if pred(s, ix)), -1)


def find_in_array(seq, predicate):
	l = [i for (i, value) in enumerate(seq) if predicate(value, i)]
	return l[0] if l else -1


def find_in_array(seq, predicate):
	for (i, x) in enumerate(seq):
		if predicate(x, i):
			return i
	return -1


def find_in_array(seq, predicate):
	for (i, elem) in enumerate(seq):
		if predicate(elem, i):
			return i
	return -1