*** No Loops Allowed ***

You will be given an array (a) and a value (x). All you need to do is check whether the provided array contains the value, without using a loop.

Array can contain numbers or strings. X can be either. Return true if the array contains the value, false if not. With strings you will need to account for case.

Looking for more, loop-restrained fun? Check out the other kata in the series:

 https://www.codewars.com/kata/no-loops-1-small-enough
 https://www.codewars.com/kata/no-loops-3-copy-within

Difficulty: EASY
Tags: Fundamentals

Data structures
Skill types: Data structures

Starter code:
def check(a, x):
	

Solutions:
def check(a, x):
	return x in a


check = lambda a, x: x in a


check = list.__contains__


from operator import contains as check


def check(a, x):
	return a.count(x) > 0


def check(a, x):
	return True if x in a else False


def check(a, x):
	try:
		i = a.index(x)
		return True
	except ValueError:
		return False


check = lambda a, x: a != [] and (a[0] == x or check(a[1:], x))


def check(a, x):
	try:
		return x in a
	except TypeError:
		return x == a


def check(a, x):
	if a:
		if a[0] == x:
			return True
		else:
			return check(a[1:], x)
	else:
		return False
	pass


from typing import List, Union

def check(array: List[Union[int, str]], value: Union[int, str]) -> bool:
	return value in array


def check(arr, val):
	return val in arr


def check(a, x):
	return set(a) == set(a + [x])


def check(a, x):
	if len(a) == 0:
		return False
	item = a.pop()
	if item == x:
		return True
	else:
		return check(a, x)


def check(a, x):
	if x in a:
		true = True
		return true
	else:
		false = False
		return false
	pass


def check(a, x):
	return x in range(a[0], a[1] + 1) if type(a) == 'int' else x in a


def check(a, x):
	return any(map(lambda e: e == x, a))


check = lambda a, b: b in a


def check_helper(a, x, index):
	if index == len(a):
		return False
	if a[index] == x:
		return True
	return check_helper(a, x, index + 1)

def check(a, x):
	return check_helper(a, x, 0)


def check(a, x):
	return str(x) in a or x in a


def check(a, x):
	if not a:
		return False
	if a[0] == x:
		return True
	else:
		return check(a[1:], x)


def check(a, x):
	if x in a:
		return True
	if x not in a:
		return False
	else:
		return 0


def check(a, x):
	b = a.count(x)
	if b == 0:
		return False
	else:
		return True
	pass


def check(a, x):
	a.append(x)
	return bool(a.count(x) - 1)


def check(a, x):
	return x.lower() or x.upper() in a if type(a[0]) == 'str' and type(x) == 'str' else x in a


def check(a, x):
	try:
		if x in a:
			return True
		elif str(x).lower in a:
			return True
	except ValueError:
		return False
	else:
		return False


def check(a, x):
	if x in a:
		return 1
	else:
		return 0


def check(seq, elem):
	return elem in seq


def check(a, x):
	if x in a:
		return True
	else:
		return False
x = check(['what', 'a', 'great', 'kata'], 'kat')
print(x)


def check(a, x):
	try:
		a.index(x)
		return True
	except:
		return False


def check(a, x):
	try:
		if x in a or x.lower() in a.lower():
			return True
		else:
			return False
	except AttributeError:
		return False


def check(a, x):
	return a.__contains__(x) or a.__contains__(str(x))


check = lambda a, x: False if len(a) == 0 else True if a.pop() == x else check(a, x)


def check(a, x):
	return any([n == x for n in a])


def check(a, x):
	try:
		return True if a.index(x) != -1 else False
	except:
		return False


def check(a, x):
	try:
		if a.count(a.index(x)) >= 0:
			return True
		else:
			return False
	except ValueError:
		return False


def check(a, x):
	if isinstance(x, str) == True:
		if x in a:
			return True
		else:
			return False
	if isinstance(x, int) == True:
		if x in a:
			return True
		else:
			return False


def check(a, x):
	if x in a:
		return True
	if str in a and str in x:
		return True
	return False
	pass


def check(arr, x):
	return x in arr


def check(a, x):
	return x == a[0] or check(a[1:], x) if a else False


def check(a, x):
	if not x in a:
		return False
	return True


def check(a, x):
	return True if a.count(x) else False


def check(a, x):
	if type(x) == ' ':
		x = x.lower()
	return x in a


def check(a, x):
	a = set(a)
	a = list(a)
	a.append(x)
	if len(a) == len(set(a)):
		return False
	else:
		return True


def check(a, x):
	if a.count(x) >= 1:
		return True
	elif a.count(x) != 1:
		return False


def check(a, x):
	pass
	''.join(str(a))
	if x in a:
		return True
	else:
		return False


def check(a, x):
	[head, *tail] = a
	return True if head == x else False if len(tail) == 0 else check(tail, x)


def check(a, x):
	try:
		if type(a.index(x)) == int:
			return True
		else:
			return False
	except ValueError:
		return False


def check(a, x):
	return any(map(lambda h: h == x, a))


def check(a, x):
	if x in a:
		return True
	else:
		return False
print(check([66, 101], 66))


def check(array, number):
	return number in array


check = lambda x, y: y in x


def check(a, x):
	if len(a) == 1:
		return a[0] == x
	return a[0] == x or check(a[1:], x)


import pandas as pd

def check(a, x):
	if x in a[:]:
		return True
	else:
		return False


def check(a, x):
	if type(a) == 'string' and type(x) == 'string':
		return x.lower() in a
	else:
		return x in a


def check(a, x):
	b = set(a)
	if x in b:
		return True
	else:
		return False
	pass


def check(a, x):
	if a.count(x) != 0:
		return True
	return False


def check(a, x):
	try:
		return a.index(x) >= 0
	except:
		return False


def check(a, x):
	b = a
	try:
		return not a == b.remove(x)
	except:
		return False


def check(a, x):
	test = a.count(x)
	if test >= 1:
		return True
	else:
		return False


def check(a, x):
	if x in a:
		return True
	else:
		return False
print(check(['t', 'e', 's', 't'], 'e'))


def check(a, x):
	if len(a) == 0:
		return False
	if a[0] == x:
		return True
	else:
		return check(a[1:], x)
	return False


def check(a, x):
	try:
		a.remove(x)
		return True
	except:
		return False


def check(a, x):
	res = False
	if x in a:
		res = True
	return res
print(check([1, 2, 3, 4, 5], 55))


def check(v, x):
	if x in v:
		return True
	return False


def check(a, x):
	try:
		if a.index(x) >= 0:
			return True
	except:
		return False
	pass


def check(a, x):
	return bool(list(a).count(x))


def check(a, x):
	if x in list(str(a)) or x in list(a) or x in a:
		return True
	else:
		return False