Skip to content

Latest commit

 

History

History
47 lines (24 loc) · 835 Bytes

No_Loops_2_You_only_need_one.md

File metadata and controls

47 lines (24 loc) · 835 Bytes

CodeWars Python Solutions


No Loops 2 - You only need one

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


Given Code

def check(a, x):
    # your code here
    pass

Solution

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

See on CodeWars.com