*** 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: introductory

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

check = lambda x,a: a in x

def check(a, x): 
#My first solution

#     if x in a:
#         return True
#     else:
#         return False

#Refactored
    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

def check(a, x): 
    # array __contains__ has a loop. using in calls this builtin
    return x in a

from typing import List, Union

def check(array: List[Union[int, str]], value: Union[int, str]) -> bool:
    """ Check whether the provided array contains the value, without using a loop. """
    return value in array

def check(a, x): 
    contains = x in a 
    return contains

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

def check(a, x):
    """
        Returns True if the provided array (a) contains the value (x).
    """
    return x in a

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 {x}.issubset(set(a))

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

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

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

#Just to be cheeky

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
    # your code here
    pass

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

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


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): 
    if x in a:
        return True
    if x != a:
        return False


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:
        exists = 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))

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

# from Russia with love


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

def check(a, x): 
    if x in a:  # check if any value in a is rhe same as x 
        return True
    return False
        


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:
    
        bool(a.index(x))
        
        return True
      
    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 x in a == a: return True
    else:
        return False# your code here


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): 
    c=a.count(x)
    return c>0

def check(a, x): 
    return (x == a[0] or check(a[1:], x)) if a else False
    # return x in a # there is technically no loop


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): 
    # your code here
    pass
    ''.join(str(a))
    if x in a:
        return True
    else:
        return False

def check(a, x):
    if x == str(x):
        if str(x) in a:
            return True
        else:
            return False
    elif x == int(x):
        if int(x) in a:
            return True
    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): 
    # your code here    
        try:
            if (type(a.index(x))==int) or (type(a.index(x))==str):
                return True         
            else:
                return False
        except ValueError:
            return False

def check(a, x): 
    return x in a
# Flez


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):
    # a = array, x = value
    
    if x in a:
        return True
    else:
        return False

def check(a, x): 
    # your code here
    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): 
    # your code here
    if x in a[:]:
        return True
    else:
        return False

def check(a, x): 
    # your code here
    return False if a.count(x)==0 else True

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): 
    # your code here
    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
    pass
    pass

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

def check(a, x): 
    # your code here
    if x in a:
        check=True
    else:
        check=False
    
    return check

def check(a, x): 
    # your code here
    if x in a:
        return True
    elif x not in a:
        return False

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

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, i=0):
    if x == a[i]:
        return True
    if i == len(a) - 1:
        return False
    else:
       return check(a, x, i=i+1)


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:
       a.index(x)
    except ValueError:
       return False
    return True

def check(a, x): 
    # written by Laxus17 on 13-02-2020
    return x in a

def check(a, x):
    # I am not sure if if-else is also included in loop in this kata
    # written by Laxus17 on 13-02-2020
    return True if x in a else False

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

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

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

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

def check(a, x): 
    # your code herer
    if x in a:
        return True
    else:
        return False
    pass

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